<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML+RDFa 1.1//EN' 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd'>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" prefix='bibo: http://purl.org/ontology/bibo/' typeof="bibo:Document">
<head>
<title>JSON-LD Algorithms 1.0</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<!--
  === NOTA BENE ===
  For the three scripts below, if your spec resides on dev.w3 you can check them
  out in the same tree and use relative links so that they'll work offline,
  -->




<style type="text/css">
  .diff { font-weight:bold; color:#0a3; }
</style>
<style>/*****************************************************************
 * ReSpec 3 CSS
 * Robin Berjon - http://berjon.com/
 *****************************************************************/

/* --- INLINES --- */
em.rfc2119 { 
    text-transform:     lowercase;
    font-variant:       small-caps;
    font-style:         normal;
    color:              #900;
}

h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
    border: none;
}

dfn {
    font-weight:    bold;
}

a.internalDFN {
    color:  inherit;
    border-bottom:  1px solid #99c;
    text-decoration:    none;
}

a.externalDFN {
    color:  inherit;
    border-bottom:  1px dotted #ccc;
    text-decoration:    none;
}

a.bibref {
    text-decoration:    none;
}

cite .bibref {
    font-style: normal;
}

code {
    color:  #ff4500;
}


/* --- --- */
ol.algorithm { counter-reset:numsection; list-style-type: none; }
ol.algorithm li { margin: 0.5em 0; }
ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }

/* --- TOC --- */
.toc a, .tof a {
    text-decoration:    none;
}

a .secno, a .figno {
    color:  #000;
}

ul.tof, ol.tof {
    list-style: none outside none;
}

.caption {
    margin-top: 0.5em;
    font-style:   italic;
}

/* --- TABLE --- */
table.simple {
    border-spacing: 0;
    border-collapse:    collapse;
    border-bottom:  3px solid #005a9c;
}

.simple th {
    background: #005a9c;
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
}

.simple th[scope="row"] {
    background: inherit;
    color:  inherit;
    border-top: 1px solid #ddd;
}

.simple td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
}

.simple tr:nth-child(even) {
    background: #f0f6ff;
}

/* --- DL --- */
.section dd > p:first-child {
    margin-top: 0;
}

.section dd > p:last-child {
    margin-bottom: 0;
}

.section dd {
    margin-bottom:  1em;
}

.section dl.attrs dd, .section dl.eldef dd {
    margin-bottom:  0;
}
</style><style>/* --- EXAMPLES --- */
div.example-title {
    min-width: 7.5em;
    color: #b9ab2d;
}
div.example-title span {
    text-transform: uppercase;   
}
aside.example, div.example, div.illegal-example {
    padding: 0.5em;
    margin: 1em 0;
    position: relative;
    clear: both;
}
div.illegal-example { color: red }
div.illegal-example p { color: black }
aside.example, div.example {
    padding: .5em;
    border-left-width: .5em;
    border-left-style: solid;
    border-color: #e0cb52;
    background: #fcfaee;    
}

aside.example div.example {
    border-left-width: .1em;
    border-color: #999;
    background: #fff;
}
aside.example div.example div.example-title {
    color: #999;
}
</style><style>/* --- ISSUES/NOTES --- */
div.issue-title, div.note-title {
    padding-right:  1em;
    min-width: 7.5em;
    color: #b9ab2d;
}
div.issue-title { color: #e05252; }
div.note-title { color: #52e052; }
div.issue-title span, div.note-title span {
    text-transform: uppercase;
}
div.note, div.issue {
    margin-top: 1em;
    margin-bottom: 1em;
}
.note > p:first-child, .issue > p:first-child { margin-top: 0 }
.issue, .note {
    padding: .5em;
    border-left-width: .5em;
    border-left-style: solid;
}
div.issue, div.note {
    padding: 0.5em;
    margin: 1em 0;
    position: relative;
    clear: both;
}
span.note, span.issue { padding: .1em .5em .15em; }

.issue {
    border-color: #e05252;
    background: #fbe9e9;
}
.note {
    border-color: #52e052;
    background: #e9fbe9;
}


</style><style>/* --- WEB IDL --- */
pre.idl {
    border-top: 1px solid #90b8de;
    border-bottom: 1px solid #90b8de;
    padding:    1em;
    line-height:    120%;
}

pre.idl::before {
    content:    "WebIDL";
    display:    block;
    width:      150px;
    background: #90b8de;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

.idlType {
    color:  #ff4500;
    font-weight:    bold;
    text-decoration:    none;
}

/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID {
    font-weight:    bold;
    color:  #005a9c;
}

.idlSuperclass {
    font-style: italic;
    color:  #005a9c;
}

/*.idlAttribute*/
.idlAttrType, .idlFieldType, .idlMemberType {
    color:  #005a9c;
}
.idlAttrName, .idlFieldName, .idlMemberName {
    color:  #ff4500;
}
.idlAttrName a, .idlFieldName a, .idlMemberName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlMethod*/
.idlMethType, .idlCallbackType {
    color:  #005a9c;
}
.idlMethName {
    color:  #ff4500;
}
.idlMethName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlParam*/
.idlParamType {
    color:  #005a9c;
}
.idlParamName {
    font-style: italic;
}

.extAttr {
    color:  #666;
}

/*.idlConst*/
.idlConstType {
    color:  #005a9c;
}
.idlConstName {
    color:  #ff4500;
}
.idlConstName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlException*/
.idlExceptionID {
    font-weight:    bold;
    color:  #c00;
}

.idlTypedefID, .idlTypedefType {
    color:  #005a9c;
}

.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
    color:  #c00;
    font-weight:    normal;
}

.excName a {
    font-family:    monospace;
}

.idlRaises a.idlType, .excName a.idlType {
    border-bottom:  1px dotted #c00;
}

.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
    width:  45px;
    text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }

.idlImplements a {
    font-weight:    bold;
}

dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
    margin-left:    2em;
}

.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
    font-weight:    normal;
}

.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
    font-weight:    bold;
    color:  #000;
    font-family:    monospace;
}

.attributes dt code, .fields dt code, .dictionary-members dt code {
    background:  #ffffd2;
}

.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
    color:  #005a9c;
    background:  transparent;
    font-family:    inherit;
    font-weight:    normal;
    font-style: italic;
}

.methods dt code {
    background:  #d9e6f8;
}

.constants dt code {
    background:  #ddffd2;
}

.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
    margin-bottom:  1em;
}

table.parameters, table.exceptions {
    border-spacing: 0;
    border-collapse:    collapse;
    margin: 0.5em 0;
    width:  100%;
}
table.parameters { border-bottom:  1px solid #90b8de; }
table.exceptions { border-bottom:  1px solid #deb890; }

.parameters th, .exceptions th {
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
    font-family:    initial;
    font-weight:    normal;
    text-shadow:    #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }

.parameters td, .exceptions td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
    vertical-align: top;
}

.parameters tr:first-child td, .exceptions tr:first-child td {
    border-top: none;
}

.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
    width:  100px;
}

.parameters td.prmType {
    width:  120px;
}

table.exceptions table {
    border-spacing: 0;
    border-collapse:    collapse;
    width:  100%;
}
</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-ED" />
<!--[if lt IE 9]><script src='http://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]-->
<style type='text/css'>
.diff-old-a {
  font-size: smaller;
  color: red;
}

.diff-new { background-color: yellow; }
.diff-chg { background-color: lime; }
.diff-new:before,
.diff-new:after
    { content: "\2191" }
.diff-chg:before, .diff-chg:after
    { content: "\2195" }
.diff-old { text-decoration: line-through; background-color: #FBB; }
.diff-old:before,
.diff-old:after
    { content: "\2193" }
:focus { border: thin red solid}
</style>
</head>


<body>
<div class="head">
<p>
<a href="http://www.w3.org/">
<img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C" />
</a>
</p>
<h1 class="title" id="title">
JSON-LD
<del class="diff-old">API
</del>
<ins class="diff-chg">Algorithms
</ins>
1.0
</h1>
<h2 id="subtitle">
<del class="diff-old">An
Application
Programming
Interface
</del>
<ins class="diff-chg">Algorithms
</ins>
for
<del class="diff-old">the
</del>
<ins class="diff-chg">Processing
</ins>
JSON-LD
<del class="diff-old">Syntax
</del>
<ins class="diff-chg">Documents
</ins>
</h2>
<h2 id="w3c-editor-s-draft-25-december-2012">
<abbr title="World Wide Web Consortium">
W3C
</abbr>
Editor's
Draft
<del class="diff-old">30
September
</del>
<ins class="diff-chg">25
December
</ins>
2012
</h2>
<dl>
<dt>
This
version:
</dt>
<dd>
<a href="http://dvcs.w3.org/hg/json-ld/raw-file/default/spec/latest/json-ld-api/index.html">
http://dvcs.w3.org/hg/json-ld/raw-file/default/spec/latest/json-ld-api/index.html
</a>
</dd>
<dt>
Latest
published
version:
</dt>
<dd>
<a href="http://www.w3.org/TR/json-ld-api/">
http://www.w3.org/TR/json-ld-api/
</a>
</dd>
<dt>
Latest
editor's
draft:
</dt>
<dd>
<a href="http://dvcs.w3.org/hg/json-ld/raw-file/default/spec/latest/json-ld-api/index.html">
http://dvcs.w3.org/hg/json-ld/raw-file/default/spec/latest/json-ld-api/index.html
</a>
</dd>
<dt>
Editors:
</dt>
<dd rel="bibo:editor" inlist="">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Manu Sporny" href="http://manu.sporny.org/">
Manu
Sporny
</a>,
<a rel="foaf:workplaceHomepage" href="http://digitalbazaar.com/">
Digital
Bazaar
</a>
</span>
</dd>
<dd rel="bibo:editor" inlist="">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Gregg Kellogg" href="http://greggkellogg.net/">
Gregg
Kellogg
</a>,
<a rel="foaf:workplaceHomepage" href="http://kellogg-assoc.com/">
Kellogg
Associates
</a>
</span>
</dd>
<dd rel="bibo:editor" inlist="">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Markus Lanthaler" href="http://www.markus-lanthaler.com/">
Markus
Lanthaler
</a>,
<a rel="foaf:workplaceHomepage" href="http://www.tugraz.at/">
Graz
University
of
Technology
</a>
</span>
</dd>
<dt>
Authors:
</dt>
<dd rel="dcterms:contributor">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Dave Longley" href="http://digitalbazaar.com/">
Dave
Longley
</a>,
<a rel="foaf:workplaceHomepage" href="http://digitalbazaar.com/">
Digital
Bazaar
</a>
</span>
</dd>
<dd rel="dcterms:contributor">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Manu Sporny" href="http://digitalbazaar.com/">
Manu
Sporny
</a>,
<a rel="foaf:workplaceHomepage" href="http://digitalbazaar.com/">
Digital
Bazaar
</a>
</span>
</dd>
<dd rel="dcterms:contributor">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Gregg Kellogg" href="http://greggkellogg.net/">
Gregg
Kellogg
</a>,
<a rel="foaf:workplaceHomepage" href="http://kellogg-assoc.com/">
Kellogg
Associates
</a>
</span>
</dd>
<dd rel="dcterms:contributor">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Markus Lanthaler" href="http://www.markus-lanthaler.com/">
Markus
Lanthaler
</a>,
<a rel="foaf:workplaceHomepage" href="http://www.tugraz.at/">
Graz
University
of
Technology
</a>
</span>
</dd>
</dl>
<p>
This
document
is
also
available
in
this
non-normative
format:
<a href="diff-20120930.html">
diff
to
previous
version
</a>
</p>
<p class="copyright">
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
Copyright
</a>
©
2010-2012
<a href="http://www.w3.org/">
<abbr title="World Wide Web Consortium">
W3C
</abbr>
</a>
<sup>
®
</sup>
(
<a href="http://www.csail.mit.edu/">
<abbr title="Massachusetts Institute of Technology">
MIT
</abbr>
</a>,
<a href="http://www.ercim.eu/">
<abbr title="European Research Consortium for Informatics and Mathematics">
ERCIM
</abbr>
</a>,
<a href="http://www.keio.ac.jp/">
Keio
</a>
),
All
Rights
Reserved.
<abbr title="World Wide Web Consortium">
W3C
</abbr>
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">
liability
</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">
trademark
</a>
and
<a href="http://www.w3.org/Consortium/Legal/copyright-documents">
document
use
</a>
rules
apply.
</p>
<hr />
</div>
<section id="abstract" class="introductory" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" resource="#abstract" rel="bibo:chapter">
<h2>
Abstract
</h2>
<p>
JSON
[
<cite>
<a class="bibref" href="#bib-RFC4627">
RFC4627
</a>
</cite>
]
has
proven
to
be
a
highly
useful
object
serialization
and
messaging
format.
JSON-LD
[
<cite>
<a class="bibref" href="#bib-JSON-LD">
JSON-LD
</a>
</cite>
]
harmonizes
the
representation
of
Linked
Data
in
JSON
by
outlining
a
common
JSON
representation
format
for
expressing
directed
graphs;
mixing
both
Linked
Data
and
non-Linked
Data
in
a
single
document.
This
document
outlines
an
Application
Programming
Interface
and
a
set
of
algorithms
for
programmatically
transforming
JSON-LD
documents
in
order
to
make
them
easier
to
work
with
in
programming
environments
like
JavaScript,
Python,
and
Ruby.
</p>
</section>
<section id="sotd" class="introductory" typeof="bibo:Chapter" resource="#sotd" rel="bibo:chapter">
<h2>
Status
of
This
Document
</h2>
<p>
<em>
This
section
describes
the
status
of
this
document
at
the
time
of
its
publication.
Other
documents
may
supersede
this
document.
A
list
of
current
<abbr title="World Wide Web Consortium">
W3C
</abbr>
publications
and
the
latest
revision
of
this
technical
report
can
be
found
in
the
<a href="http://www.w3.org/TR/">
<abbr title="World Wide Web Consortium">
W3C
</abbr>
technical
reports
index
</a>
at
http://www.w3.org/TR/.
</em>
</p>
<p>
This
document
has
been
under
development
for
over
18
months
in
the
JSON
for
Linking
Data
Community
Group.
The
document
has
recently
been
transferred
to
the
RDF
Working
Group
for
review,
improvement,
and
publication
along
the
Recommendation
track.
The
specification
has
undergone
significant
development,
review,
and
changes
during
the
course
of
the
last
18
months.
</p>
<p>
There
are
<del class="diff-old">currently
</del>
<ins class="diff-chg">several
independent
</ins>
<a href="http://json-ld.org/#impl">
<del class="diff-old">five
</del>
interoperable
implementations
</a>
of
this
specification.
There
is
a
<a href="https://github.com/json-ld/json-ld.org/tree/main/test-suite">
fairly
complete
test
suite
</a>
and
a
<a href="http://json-ld.org/playground/">
live
JSON-LD
editor
</a>
that
is
capable
of
demonstrating
the
features
described
in
this
document.
While
development
on
implementations,
the
test
suite
and
the
live
editor
will
continue,
they
are
believed
to
be
mature
enough
to
be
integrated
into
a
non-production
system
at
this
point
in
time
with
the
expectation
that
they
could
be
used
in
a
production
system
within
the
next
year.
</p>
<div class="issue">
<div class="issue-title">
<span>
Issue
</span>
</div>
<p class="">
It
is
important
for
readers
to
understand
that
the
scope
of
this
document
is
currently
under
debate
and
new
features
may
be
added
to
the
specification.
Existing
features
may
be
modified
heavily
or
removed
entirely
from
the
specification
upon
further
review
and
feedback
from
the
broader
community.
This
is
a
work
in
progress
and
publication
as
a
Working
Draft
does
not
require
that
all
Working
Group
members
agree
on
the
content
of
the
document.
</p>
</div>
<p>
There
are
a
number
of
ways
that
one
may
participate
in
the
development
of
this
specification:
</p>
<ul>
<li>
If
you
want
to
make
sure
that
your
feedback
is
formally
addressed
by
the
RDF
Working
Group,
you
should
send
it
to
public-rdf-comments:
<a href="http://lists.w3.org/Archives/Public/public-rdf-comments/">
public-rdf-comments@w3.org
</a>
</li>
<li>
Ad-hoc
technical
discussion
primarily
occurs
on
the
public
community
mailing
list:
<a href="http://lists.w3.org/Archives/Public/public-linked-json/">
public-linked-json@w3.org
</a>
</li>
<li>
<a href="http://json-ld.org/minutes/">
Public
JSON-LD
Community
Group
teleconferences
</a>
are
held
on
Tuesdays
at
1500UTC
every
week.
Participation
is
open
to
the
public.
</li>
<li>
RDF
Working
Group
teleconferences
are
held
on
Wednesdays
at
1500UTC
every
week.
Participation
is
limited
to
RDF
Working
Group
members.
</li>
<li>
Specification
bugs
and
issues
should
be
reported
in
the
<a href="https://github.com/json-ld/json-ld.org/issues">
issue
tracker
</a>
if
you
do
not
want
to
send
an
e-mail
to
the
public-rdf-comments
mailing
list.
</li>
<li>
<a href="https://github.com/json-ld/json-ld.org/tree/main/spec">
Source
code
</a>
for
the
specification
can
be
found
on
Github.
</li>
<li>
The
<a href="http://webchat.freenode.net/?channels=json-ld">
#json-ld
</a>
IRC
channel
is
available
for
real-time
discussion
on
irc.freenode.net.
</li>
</ul>
<p>
This
document
was
published
by
the
<a href="http://www.w3.org/2011/rdf-wg/">
RDF
Working
Group
</a>
as
an
Editor's
Draft.
If
you
wish
to
make
comments
regarding
this
document,
please
send
them
to
<a href="mailto:public-rdf-comments@w3.org">
public-rdf-comments@w3.org
</a>
(
<a href="mailto:public-rdf-comments-request@w3.org?subject=subscribe">
subscribe
</a>,
<a href="http://lists.w3.org/Archives/Public/public-rdf-comments/">
archives
</a>
).
All
feedback
is
welcome.
</p>
<p>
Publication
as
an
Editor's
Draft
does
not
imply
endorsement
by
the
<abbr title="World Wide Web Consortium">
W3C
</abbr>
Membership.
This
is
a
draft
document
and
may
be
updated,
replaced
or
obsoleted
by
other
documents
at
any
time.
It
is
inappropriate
to
cite
this
document
as
other
than
work
in
progress.
</p>
<p>
This
document
was
produced
by
a
group
operating
under
the
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">
5
February
2004
<abbr title="World Wide Web Consortium">
W3C
</abbr>
Patent
Policy
</a>.
<abbr title="World Wide Web Consortium">
W3C
</abbr>
maintains
a
<a href="http://www.w3.org/2004/01/pp-impl/46168/status" rel="disclosure">
public
list
of
any
patent
disclosures
</a>
made
in
connection
with
the
deliverables
of
the
group;
that
page
also
includes
instructions
for
disclosing
a
patent.
An
individual
who
has
actual
knowledge
of
a
patent
which
the
individual
believes
contains
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
Essential
Claim(s)
</a>
must
disclose
the
information
in
accordance
with
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">
section
6
of
the
<abbr title="World Wide Web Consortium">
W3C
</abbr>
Patent
Policy
</a>.
</p>
</section>
<section id="toc">
<h2 class="introductory">
Table
of
Contents
</h2>
<ul class="toc">
<li class="tocline">
<a href="#introduction" class="tocxref">
<span class="secno">
1.
</span>
Introduction
</a>
</li>
<li class="tocline">
<a href="#features" class="tocxref">
<span class="secno">
2.
</span>
Features
</a>
<ul class="toc">
<li class="tocline">
<a href="#expansion" class="tocxref">
<span class="secno">
2.1
</span>
Expansion
</a>
</li>
<li class="tocline">
<a href="#compaction" class="tocxref">
<span class="secno">
2.2
</span>
Compaction
</a>
</li>
<li class="tocline">
<a href="#flattening" class="tocxref">
<span class="secno">
2.3
</span>
<del class="diff-old">RDF
Conversion
</del>
<ins class="diff-chg">Flattening
</ins>
</a>
</li>
<li class="tocline">
<a href="#rdf-conversion" class="tocxref">
<span class="secno">
<del class="diff-old">3.
</del>
<ins class="diff-chg">2.4
</ins>
</span>
<del class="diff-old">The
Application
Programming
Interface
</del>
<ins class="diff-chg">RDF
Conversion
</ins>
</a>
</li>
<del class="diff-old">3.1
General
Terminology
</del>
</ul>
</li>
<li class="tocline">
<a href="#conformance" class="tocxref">
<span class="secno">
<del class="diff-old">3.2
</del>
<ins class="diff-chg">3.
</ins>
</span>
<del class="diff-old">JsonLdProcessor
</del>
<ins class="diff-chg">Conformance
</ins>
</a>
</li>
<li class="tocline">
<a href="#general-terminology" class="tocxref">
<span class="secno">
<del class="diff-old">3.2.1
</del>
<ins class="diff-chg">4.
</ins>
</span>
<del class="diff-old">Methods
</del>
<ins class="diff-chg">General
Terminology
</ins>
</a>
</li>
<li class="tocline">
<a href="#algorithms" class="tocxref">
<span class="secno">
<del class="diff-old">3.3
</del>
<ins class="diff-chg">5.
</ins>
</span>
<del class="diff-old">Callbacks
</del>
<ins class="diff-chg">Algorithms
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a href="#algorithm-terms" class="tocxref">
<span class="secno">
<del class="diff-old">3.3.1
</del>
<ins class="diff-chg">5.1
</ins>
</span>
<del class="diff-old">JsonLdProcessingError
</del>
<ins class="diff-chg">Algorithm
Terms
</ins>
</a>
</li>
<li class="tocline">
<a href="#expansion-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.3.2
</del>
<ins class="diff-chg">5.2
</ins>
</span>
<del class="diff-old">JsonLdCallback
</del>
<ins class="diff-chg">Expansion
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a href="#context-processing" class="tocxref">
<span class="secno">
<del class="diff-old">3.3.3
</del>
<ins class="diff-chg">5.3
</ins>
</span>
<del class="diff-old">QuadCallback
</del>
<ins class="diff-chg">Context
Processing
</ins>
</a>
</li>
<li class="tocline">
<a href="#iri-expansion" class="tocxref">
<span class="secno">
<del class="diff-old">3.3.4
</del>
<ins class="diff-chg">5.4
</ins>
</span>
<del class="diff-old">ConformanceCallback
</del>
<del class="diff-old">3.4
Data
Structures
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
</ins>
</a>
</li>
<li class="tocline">
<a href="#value-expansion" class="tocxref">
<span class="secno">
<del class="diff-old">3.4.1
</del>
<ins class="diff-chg">5.5
</ins>
</span>
<del class="diff-old">IRI
</del>
<ins class="diff-chg">Value
Expansion
</ins>
</a>
</li>
<li class="tocline">
<a href="#label-blank-nodes-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.4.2
</del>
<ins class="diff-chg">5.6
</ins>
</span>
<del class="diff-old">JsonLdOptions
</del>
<ins class="diff-chg">Label
Blank
Nodes
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a href="#generate-blank-node-identifier" class="tocxref">
<span class="secno">
<del class="diff-old">3.4.3
</del>
<ins class="diff-chg">5.7
</ins>
</span>
<del class="diff-old">Quad
</del>
<ins class="diff-chg">Generate
Blank
Node
Identifier
</ins>
</a>
</li>
<li class="tocline">
<a href="#compaction-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.4.4
</del>
<ins class="diff-chg">5.8
</ins>
</span>
<del class="diff-old">Node
</del>
<ins class="diff-chg">Compaction
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a href="#iri-compaction-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.4.5
</del>
<ins class="diff-chg">5.9
</ins>
</span>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-chg">Compaction
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a href="#inverse-context-creation" class="tocxref">
<span class="secno">
<del class="diff-old">3.4.6
</del>
<ins class="diff-chg">5.10
</ins>
</span>
<del class="diff-old">Blank
Node
</del>
<ins class="diff-chg">Inverse
Context
Creation
</ins>
</a>
</li>
<li class="tocline">
<a href="#inverse-context-query-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">3.4.7
</del>
<ins class="diff-chg">5.11
</ins>
</span>
<del class="diff-old">Literal
</del>
<ins class="diff-chg">Inverse
Context
Query
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a href="#value-compaction" class="tocxref">
<span class="secno">
<del class="diff-old">4.
</del>
<ins class="diff-chg">5.12
</ins>
</span>
<del class="diff-old">Algorithms
</del>
<ins class="diff-chg">Value
Compaction
</ins>
</a>
</li>
<li class="tocline">
<a href="#find-and-remove-property-generator-duplicates" class="tocxref">
<span class="secno">
<del class="diff-old">4.1
</del>
<ins class="diff-chg">5.13
</ins>
</span>
<del class="diff-old">Algorithm
Terms
</del>
<ins class="diff-chg">Find
and
Remove
Property
Generator
Duplicates
</ins>
</a>
</li>
<li class="tocline">
<a href="#flattening-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">4.2
</del>
<ins class="diff-chg">5.14
</ins>
</span>
<del class="diff-old">Context
Processing
</del>
<ins class="diff-chg">Flattening
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a href="#node-map-generation" class="tocxref">
<span class="secno">
<del class="diff-old">4.3
</del>
<ins class="diff-chg">5.15
</ins>
</span>
<del class="diff-old">IRI
Expansion
</del>
<ins class="diff-chg">Node
Map
Generation
</ins>
</a>
</li>
<li class="tocline">
<a href="#rdf-conversion-algorithms" class="tocxref">
<span class="secno">
<del class="diff-old">4.4
</del>
<ins class="diff-chg">5.16
</ins>
</span>
<del class="diff-old">IRI
Compaction
</del>
<ins class="diff-chg">RDF
Conversion
Algorithms
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a href="#convert-to-rdf-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">4.4.1
</del>
<ins class="diff-chg">5.16.1
</ins>
</span>
<del class="diff-old">IRI
Compaction
</del>
<ins class="diff-chg">Convert
to
RDF
</ins>
Algorithm
</a>
</li>
<li class="tocline">
<a href="#list-conversion" class="tocxref">
<span class="secno">
<del class="diff-old">4.4.2
</del>
<ins class="diff-chg">5.16.2
</ins>
</span>
<del class="diff-old">Term
Rank
Algorithm
</del>
<ins class="diff-chg">List
Conversion
</ins>
</a>
</li>
<li class="tocline">
<a href="#convert-from-rdf-algorithm" class="tocxref">
<span class="secno">
<del class="diff-old">4.5
</del>
<ins class="diff-chg">5.16.3
</ins>
</span>
<del class="diff-old">Value
Expansion
</del>
<ins class="diff-chg">Convert
from
RDF
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a href="#data-round-tripping" class="tocxref">
<span class="secno">
<del class="diff-old">4.6
</del>
<ins class="diff-chg">5.16.4
</ins>
</span>
<del class="diff-old">Value
Compaction
</del>
<ins class="diff-chg">Data
Round
Tripping
</ins>
</a>
</li>
<del class="diff-old">4.7
Expansion
4.7.1
Expansion
Algorithm
</del>
</ul>
</li>
</ul>
</li>
<li class="tocline">
<a href="#the-application-programming-interface" class="tocxref">
<span class="secno">
<del class="diff-old">4.8
</del>
<ins class="diff-chg">6.
</ins>
</span>
<del class="diff-old">Compaction
</del>
<ins class="diff-chg">The
Application
Programming
Interface
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a href="#jsonldprocessor" class="tocxref">
<span class="secno">
<del class="diff-old">4.8.1
</del>
<ins class="diff-chg">6.1
</ins>
</span>
<del class="diff-old">Compaction
Algorithm
</del>
<ins class="diff-chg">JsonLdProcessor
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a href="#methods" class="tocxref">
<span class="secno">
<del class="diff-old">4.9
</del>
<ins class="diff-chg">6.1.1
</ins>
</span>
<del class="diff-old">Flattening
</del>
<ins class="diff-chg">Methods
</ins>
</a>
</li>
<del class="diff-old">4.9.1
Flattening
Algorithm
</del>
</ul>
</li>
<li class="tocline">
<a href="#callbacks" class="tocxref">
<span class="secno">
<del class="diff-old">4.9.2
</del>
<ins class="diff-chg">6.2
</ins>
</span>
<del class="diff-old">Node
Map
Generation
</del>
<ins class="diff-chg">Callbacks
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a href="#jsonldcallback" class="tocxref">
<span class="secno">
<del class="diff-old">4.9.3
</del>
<ins class="diff-chg">6.2.1
</ins>
</span>
<del class="diff-old">Generate
Blank
Node
Identifier
</del>
<ins class="diff-chg">JsonLdCallback
</ins>
</a>
</li>
</ul>
</li>
<li class="tocline">
<a href="#data-structures" class="tocxref">
<span class="secno">
<del class="diff-old">4.10
</del>
<ins class="diff-chg">6.3
</ins>
</span>
<del class="diff-old">RDF
Conversion
</del>
<ins class="diff-chg">Data
Structures
</ins>
</a>
<ul class="toc">
<li class="tocline">
<del class="diff-old">4.10.1
Overview
4.10.2
Parsing
Examples
</del>
<a href="#jsonldoptions" class="tocxref">
<span class="secno">
<del class="diff-old">4.10.3
</del>
<ins class="diff-chg">6.3.1
</ins>
</span>
<del class="diff-old">Convert
to
RDF
Algorithm
</del>
<ins class="diff-chg">JsonLdOptions
</ins>
</a>
</li>
<li class="tocline">
<a href="#jsonldprocessingerror" class="tocxref">
<span class="secno">
<del class="diff-old">4.10.4
</del>
<ins class="diff-chg">6.3.2
</ins>
</span>
<del class="diff-old">List
Conversion
</del>
<ins class="diff-chg">JsonLdProcessingError
</ins>
</a>
</li>
<li class="tocline">
<a href="#jsonlderrorcode" class="tocxref">
<span class="secno">
<del class="diff-old">4.10.5
</del>
<ins class="diff-chg">6.3.3
</ins>
</span>
<del class="diff-old">Convert
from
RDF
Algorithm
</del>
<ins class="diff-chg">JsonLdErrorCode
</ins>
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="tocline">
<del class="diff-old">5.
Data
Round
Tripping
</del>
<a href="#acknowledgements" class="tocxref">
<span class="secno">
A.
</span>
Acknowledgements
</a>
</li>
<li class="tocline">
<a href="#references" class="tocxref">
<span class="secno">
B.
</span>
References
</a>
<ul class="toc">
<li class="tocline">
<a href="#normative-references" class="tocxref">
<span class="secno">
B.1
</span>
Normative
references
</a>
</li>
<li class="tocline">
<a href="#informative-references" class="tocxref">
<span class="secno">
B.2
</span>
Informative
references
</a>
</li>
</ul>
</li>
</ul>
</section>
<section class="informative" id="introduction">
<h2>
<span class="secno">
1.
</span>
Introduction
</h2>
<p>
<em>
<ins class="diff-new">This
section
is
non-normative.
</ins></em></p>
<p>
This
document
is
a
detailed
specification
for
an
Application
Programming
Interface
for
the
JSON-LD
Syntax.
The
document
is
primarily
intended
for
the
following
audiences:
</p>
<ul>
<li>
Web
authors
and
developers
that
want
a
very
detailed
view
of
how
a
JSON-LD
processor
and
the
API
operates.
</li>
<li>
Software
developers
that
want
to
implement
processors
and
APIs
for
JSON-LD.
</li>
</ul>
<p>
To
understand
the
basics
in
this
specification
you
must
first
be
familiar
with
JSON,
which
is
detailed
in
[
<cite>
<a class="bibref" href="#bib-RFC4627">
RFC4627
</a>
</cite>
].
You
must
also
understand
the
JSON-LD
Syntax
[
<cite>
<a class="bibref" href="#bib-JSON-LD">
JSON-LD
</a>
</cite>
],
which
is
the
base
syntax
used
by
all
of
the
algorithms
in
this
document.
To
understand
the
API
and
how
it
is
intended
to
operate
in
a
programming
environment,
it
is
useful
to
have
working
knowledge
of
the
JavaScript
programming
language
[
<cite>
<a class="bibref" href="#bib-ECMA-262">
ECMA-262
</a>
</cite>
]
and
WebIDL
[
<cite>
<a class="bibref" href="#bib-WEBIDL">
WEBIDL
</a>
</cite>
].
To
understand
how
JSON-LD
maps
to
RDF,
it
is
helpful
to
be
familiar
with
the
basic
RDF
concepts
[
<cite>
<a class="bibref" href="#bib-RDF-CONCEPTS">
RDF-CONCEPTS
</a>
</cite>
].
</p>
</section>
<section class="informative" id="features">
<h2>
<span class="secno">
2.
</span>
Features
</h2>
<p>
<em>
<ins class="diff-new">This
section
is
non-normative.
</ins></em></p>
<p>
The
JSON-LD
Syntax
specification
[
<cite>
<a class="bibref" href="#bib-JSON-LD">
JSON-LD
</a>
</cite>
]
outlines
a
language
that
may
be
used
to
express
Linked
Data
in
JSON.
Often,
it
is
useful
to
be
able
to
transform
JSON-LD
documents
so
that
they
may
be
easily
processed
in
<del class="diff-old">a
</del>
<ins class="diff-chg">various
</ins>
programming
<del class="diff-old">environment
like
JavaScript,
Python
or
Ruby.
</del>
<ins class="diff-chg">environments.
</ins>
</p>
<p>
There
are
four
major
types
of
transformation
that
are
discussed
in
this
<del class="diff-old">document;
compaction,
</del>
<ins class="diff-chg">document:
</ins>
expansion,
<ins class="diff-new">compaction,
flattening,
</ins>
and
RDF
conversion.
</p>
<section class="informative" id="expansion">
<h3>
<span class="secno">
2.1
</span>
Expansion
</h3>
<p>
<em>
<ins class="diff-new">This
section
is
non-normative.
</ins></em></p>
<p>
Software
algorithms
are
easiest
to
write
when
the
data
that
they
are
processing
have
a
regular
form.
Since
information
can
be
represented
by
JSON-LD
in
a
variety
of
different
ways,
transforming
all
of
these
methods
into
a
uniform
structure
allows
the
developer
to
simplify
their
processing
code.
For
example,
note
that
the
following
input
uses
only
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
s
and
is
fairly
compact:
</p>
<del class="diff-old">  var input1 = {
  &quot;@context&quot;: &quot;http://json-ld.org/contexts/person.jsonld&quot;
  &quot;name&quot;: &quot;Manu Sporny&quot;,
  &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
</del>
  <div class="example"><div class="example-title"><span>Example 1</span></div><pre class="example">{
<ins class="diff-chg">  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  },
  &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
  &quot;name&quot;: &quot;Markus Lanthaler&quot;,
  &quot;homepage&quot;: &quot;http://www.markus-lanthaler.com/&quot;
</ins>
}
</pre>
</div>
<p>
The
next
input
example
uses
one
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
to
express
a
property,
but
leaves
the
rest
of
the
information
untouched.
</p>
<del class="diff-old">  var input2 = {
  &quot;@context&quot;: &quot;http://json-ld.org/contexts/person.jsonld&quot;
  &quot;&quot;: &quot;Manu Sporny&quot;,
  &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
</del>
  <div class="example"><div class="example-title"><span>Example 2</span></div><pre class="example">{
<ins class="diff-chg">  &quot;@context&quot;: {
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  },
  &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
  &quot;<span class="diff">http://xmlns.com/foaf/0.1/name</span>&quot;: &quot;Markus Lanthaler&quot;,
  &quot;homepage&quot;: &quot;http://www.markus-lanthaler.com/&quot;
</ins>
}
</pre>
</div>
<p>
While
both
inputs
are
valid
JSON-LD,
writing
a
program
to
handle
every
permutation
of
possible
inputs
can
be
difficult,
especially
when
the
incoming
context
could
change
as
well.
To
ensure
that
the
data
can
be
given
a
more
uniform
structure,
JSON-LD
introduces
the
notion
of
expansion.
<dfn title="expansion" id="dfn-expansion">
Expansion
</dfn>
performs
two
important
operations.
The
first
is
to
expand
all
values
that
<del class="diff-old">are
</del>
<ins class="diff-chg">represent
</ins>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<del class="diff-old">IRI
</del>
<ins class="diff-chg">IRIs
</ins>
</a>
<del class="diff-old">s
</del>
to
<del class="diff-old">their
fully
expanded
form.
</del>
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
<ins class="diff-chg">absolute
IRIs
</ins></a>.
The
second
is
to
express
all
values
in
<a class="tref internalDFN" title="expanded_form" href="#dfn-expanded_form">
expanded
form
<del class="diff-old">.
To
transform
both
inputs
above
to
the
same
representation,
</del>
</a>.
<ins class="diff-chg">Running
</ins>
the
<del class="diff-old">developer
could
do
</del>
<a href="#expansion-algorithm">
<ins class="diff-chg">Expansion
algorithm
</ins></a><ins class="diff-chg">
against
</ins>
the
<del class="diff-old">following:
  function expansionCallback(output) {
   console.log(output);
}
// the second parameter is 'null' because the developer does not wish to
// inject another context value
jsonld.expand(input1, null, expansionCallback);
jsonld.expand(input2,
null,
expansionCallback);
The
output
for
both
calls
</del>
<ins class="diff-chg">examples
provided
</ins>
above
<del class="diff-old">will
be:
</del>
<ins class="diff-chg">results
in
the
following
output:
</ins>
</p>
<del class="diff-old">  [{
  &quot;http://xmlns.com/foaf/0.1/name&quot;: [{
    &quot;@value&quot;: &quot;Manu Sporny&quot;
  }],
  &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [{
    &quot;@id&quot;: &quot;http://manu.sporny.org/&quot;
  }]
}]
</del>
  <div class="example"><div class="example-title"><span>Example 3</span></div><pre class="example">[
<ins class="diff-chg">  {
    &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Markus Lanthaler&quot; }
    ],
    &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [
      { &quot;@id&quot;: &quot;http://www.markus-lanthaler.com/&quot; }
    ]
  }
]
</ins>
</pre>
</div>
<p>
Note
that
in
the
<del class="diff-old">example
above;
</del>
<ins class="diff-chg">output
above
</ins>
all
<a class="tref internalDFN" title="context" href="#dfn-context">
context
</a>
definitions
have
been
removed,
all
<a class="tref internalDFN" title="term" href="#dfn-term">
<del class="diff-old">term
</del>
<ins class="diff-chg">terms
</ins>
</a>
and
<a class="tref internalDFN" title="prefix" href="#dfn-prefix">
prefixes
</a>
have
been
expanded
to
<del class="diff-old">full
IRIs,
</del>
<ins class="diff-chg">absolute
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><ins class="diff-chg">
IRIs
</ins></a>,
and
all
<del class="diff-old">literal
</del>
<a class="tref internalDFN" title="json-ld_value" href="#dfn-json-ld_value">
<ins class="diff-chg">JSON-LD
values
</ins>
</a>
<del class="diff-old">s
</del>
are
expressed
in
<a class="tref internalDFN" title="expanded_form" href="#dfn-expanded_form">
expanded
form
</a>.
While
the
output
is
more
difficult
for
a
human
to
read,
it
is
easier
for
a
software
program
to
process
because
of
its
very
regular
structure.
</p>
</section>
<section class="informative" id="compaction">
<h3>
<span class="secno">
2.2
</span>
Compaction
</h3>
<p>
<em>
<ins class="diff-new">This
section
is
non-normative.
</ins></em></p>
<p>
While
expansion
expands
a
given
input
as
much
as
possible,
compaction
performs
the
opposite
<del class="diff-old">operation
-
expressing
</del>
<ins class="diff-chg">operation:
it
expresses
</ins>
a
given
input
as
succinctly
as
possible.
<del class="diff-old">While
</del>
<ins class="diff-chg">In
contrast
to
</ins>
expansion
<ins class="diff-new">which
</ins>
is
meant
to
produce
something
that
is
easy
to
process
by
software
programs,
compaction
is
meant
to
produce
something
that
is
easy
to
read
by
software
developers.
Compaction
uses
a
developer-supplied
<a class="tref internalDFN" title="context" href="#dfn-context">
context
</a>
to
<del class="diff-old">compresses
all
</del>
<ins class="diff-chg">compress
</ins>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<del class="diff-old">IRI
</del>
<ins class="diff-chg">IRIs
</ins>
</a>
<del class="diff-old">s
</del>
to
<a class="tref internalDFN" title="term" href="#dfn-term">
<del class="diff-old">term
</del>
<ins class="diff-chg">terms
</ins>
</a>
<del class="diff-old">s
</del>
or
<del class="diff-old">prefix
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
IRIs
</ins>
</a>
<del class="diff-old">es,
</del>
and
<del class="diff-old">compacts
all
literal
</del>
<a class="tref internalDFN" title="json-ld_value" href="#dfn-json-ld_value">
<ins class="diff-chg">JSON-LD
values
</ins>
</a>
<del class="diff-old">s
</del>
expressed
in
<a class="tref internalDFN" title="expanded_form" href="#dfn-expanded_form">
expanded
form
</a>
<ins class="diff-new">to
simple
values
such
</ins>
as
<del class="diff-old">much
as
possible.
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
<ins class="diff-chg">strings
</ins></a><ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="number" href="#dfn-number"><ins class="diff-chg">
numbers
</ins></a>.
</p>
<p>
<del class="diff-old">The
</del>
<ins class="diff-chg">For
example,
assume
the
</ins>
following
<del class="diff-old">example
expresses
</del>
<ins class="diff-chg">expanded
JSON-LD
</ins>
input
<del class="diff-old">that
has
already
been
fully
expanded:
</del>
<ins class="diff-chg">document:
</ins>
</p>
<del class="diff-old">  var expandedInput = [{
  &quot;http://xmlns.com/foaf/0.1/name&quot;: [{
    &quot;@value&quot;: &quot;Manu Sporny&quot;
  }],
  &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [{
    &quot;@id&quot;: &quot;http://manu.sporny.org/&quot;
  }]
}]
</del>
  <div class="example"><div class="example-title"><span>Example 4</span></div><pre class="example">[
<ins class="diff-chg">  {
    &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Markus Lanthaler&quot; }
    ],
    &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [
      { &quot;@id&quot;: &quot;http://www.markus-lanthaler.com/&quot; }
    ]
  }
]
</ins>
</pre>
</div>
<p>
<del class="diff-old">A
developer
that
wants
to
transform
the
data
above
into
a
more
human-readable
form,
could
do
</del>
<ins class="diff-chg">Additionally,
assume
</ins>
the
following
<del class="diff-old">using
the
</del>
<ins class="diff-chg">developer-supplied
</ins>
JSON-LD
<del class="diff-old">API:
</del>
<a class="tref internalDFN" title="context" href="#dfn-context">
<ins class="diff-chg">context
</ins></a>:
</p>
<del class="diff-old">  function compactionCallback(output) {
   console.log(output);
</del>
  <div class="example"><div class="example-title"><span>Example 5</span></div><pre class="example">{
<ins class="diff-chg">  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  }
</ins>
}
<del class="diff-old">jsonld.compact(expandedInput,
&quot;http://json-ld.org/contexts/person.jsonld&quot;,
compactionCallback);
</del>
</pre>
</div>
<p>
<del class="diff-old">The
following
would
be
</del>
<ins class="diff-chg">Running
the
</ins><a href="#compaction-algorithm"><ins class="diff-chg">
Compaction
Algorithm
</ins></a><ins class="diff-chg">
given
</ins>
the
<ins class="diff-new">context
supplied
above
against
the
JSON-LD
input
document
provided
above
would
</ins>
result
<del class="diff-old">of
</del>
<ins class="diff-chg">in
</ins>
the
<del class="diff-old">call
above:
</del>
<ins class="diff-chg">following
output:
</ins>
</p>
<del class="diff-old">  {
  &quot;@context&quot;: &quot;http://json-ld.org/contexts/person.jsonld&quot;
  &quot;name&quot;: &quot;Manu Sporny&quot;,
  &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
</del>
  <div class="example"><div class="example-title"><span>Example 6</span></div><pre class="example">{
<ins class="diff-chg">  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  },
  &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
  &quot;name&quot;: &quot;Markus Lanthaler&quot;,
  &quot;homepage&quot;: &quot;http://www.markus-lanthaler.com/&quot;
</ins>
}
</pre>
</div>
<p>
Note
that
all
<del class="diff-old">of
the
term
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<ins class="diff-chg">IRIs
</ins>
</a>
<del class="diff-old">s
</del>
have
been
<del class="diff-old">compressed
and
</del>
<ins class="diff-chg">compacted
to
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
as
specified
in
</ins>
the
<a class="tref internalDFN" title="context" href="#dfn-context">
context
</a>
<ins class="diff-new">which
consequently
</ins>
has
been
injected
into
the
output.
While
compacted
output
is
most
useful
to
humans,
it
can
<ins class="diff-new">often
</ins>
also
be
<del class="diff-old">carefully
</del>
used
to
generate
structures
that
are
easy
to
<del class="diff-old">use
for
</del>
<ins class="diff-chg">program
against.
Compaction
enables
</ins>
developers
to
<del class="diff-old">program
against
as
well.
</del>
<ins class="diff-chg">map
any
expanded
document
into
an
application-specific
compacted
document.
While
the
context
provided
above
mapped
</ins><code><ins class="diff-chg">
http://xmlns.com/foaf/0.1/name
</ins></code><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
name
</ins></code>,<ins class="diff-chg">
it
could
have
also
have
been
mapped
to
any
other
term
provided
by
the
developer.
</ins>
</p>
</section>
<section class="informative" id="flattening">
<h3>
<span class="secno">
2.3
</span>
<ins class="diff-new">Flattening
</ins></h3><p><em><ins class="diff-new">
This
section
is
non-normative.
</ins></em></p><p><ins class="diff-new">
While
expansion
ensures
that
a
document
is
in
a
uniform
structure,
flattening
goes
a
step
further
and
ensures
that
also
the
shape
of
the
data
is
deterministic.
In
expanded
documents
properties
of
a
single
</ins><a class="tref internalDFN" title="node" href="#dfn-node"><ins class="diff-new">
node
</ins></a><ins class="diff-new">
may
still
be
spread
across
a
number
of
different
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
objects
</ins></a>.<ins class="diff-new">
By
flattening
a
document,
all
properties
of
a
</ins><a class="tref internalDFN" title="node" href="#dfn-node"><ins class="diff-new">
node
</ins></a><ins class="diff-new">
are
collected
in
a
single
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
and
all
</ins><a class="tref internalDFN" title="blank_node" href="#dfn-blank_node"><ins class="diff-new">
blank
nodes
</ins></a><ins class="diff-new">
are
labeled
with
a
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-new">
blank
node
identifier
</ins></a>.<ins class="diff-new">
Often
this
drastically
simplifies
the
code
to
process
JSON-LD
data.
</ins></p><p><ins class="diff-new">
For
example,
assume
the
following
JSON-LD
input
document:
</ins></p>  <div class="example"><div class="example-title"><span>Example 7</span></div><pre class="example">{<ins class="diff-new">
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;knows&quot;: &quot;http://xmlns.com/foaf/0.1/knows&quot;
  },
  &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
  &quot;name&quot;: &quot;Markus Lanthaler&quot;,
  &quot;knows&quot;: [
    {
      &quot;name&quot;: &quot;Manu Sporny&quot;,
      &quot;knows&quot;: {
        &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;
      }
    },
    {
      &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
      &quot;name&quot;: &quot;Gregg Kellogg&quot;
    }
  ]
}
</ins></pre></div><p><ins class="diff-new">
Running
the
</ins><a href="#flattening-algorithm"><ins class="diff-new">
Flattening
Algorithm
</ins></a><ins class="diff-new">
with
a
context
set
to
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
to
prevent
compaction
returns
the
following
document:
</ins></p>  <div class="example"><div class="example-title"><span>Example 8</span></div><pre class="example">[<ins class="diff-new">
  {
    &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Markus Lanthaler&quot; }
    ],
    &quot;http://xmlns.com/foaf/0.1/knows&quot;: [
      { &quot;@id&quot;: &quot;_:t0&quot; },
      { &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot; }
    ]
  },
  {
    &quot;@id&quot;: &quot;_:t0&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Manu Sporny&quot; }
    ],
    &quot;http://xmlns.com/foaf/0.1/knows&quot;: [
      { &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot; }
    ]
  },
  {
    &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Gregg Kellogg&quot; }
    ]
  }
]
</ins></pre></div><p><ins class="diff-new">
Note
how
in
the
output
above
all
properties
of
a
</ins><a class="tref internalDFN" title="node" href="#dfn-node"><ins class="diff-new">
node
</ins></a><ins class="diff-new">
are
collected
in
a
single
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
and
how
the
</ins><a class="tref internalDFN" title="blank_node" href="#dfn-blank_node"><ins class="diff-new">
blank
node
</ins></a><ins class="diff-new">
representing
&quot;Manu
Sporny&quot;
has
been
assigned
the
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-new">
blank
node
identifier
</ins></a><code><ins class="diff-new">
_:t0
</ins></code>.</p><p><ins class="diff-new">
To
make
it
easier
for
humans
to
read
such
a
flattened
document
can
be
compacted
by
passing
a
context.
Using
the
same
context
as
the
input
document,
the
flattened
and
compacted
document
looks
as
follows:
</ins></p>  <div class="example"><div class="example-title"><span>Example 9</span></div><pre class="example">{<ins class="diff-new">
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;knows&quot;: &quot;http://xmlns.com/foaf/0.1/knows&quot;
  },
  &quot;@graph&quot;: [
    {
      &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
      &quot;name&quot;: &quot;Markus Lanthaler&quot;,
      &quot;knows&quot;: [
        { &quot;@id&quot;: &quot;_:t0&quot; },
        { &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot; }
      ]
    },
    {
      &quot;@id&quot;: &quot;_:t0&quot;,
      &quot;name&quot;: &quot;Manu Sporny&quot;,
      &quot;knows&quot;: {
        &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;
      }
    },
    {
      &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
      &quot;name&quot;: &quot;Gregg Kellogg&quot;
    }
  ]
}
</ins></pre></div><p><ins class="diff-new">
Please
note
that
the
flattened
and
compacted
result
will
always
explicitly
designate
the
default
by
the
</ins><code><ins class="diff-new">
@graph
</ins></code><ins class="diff-new">
member
in
the
top-level
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a>.<a href="#compaction"><ins class="diff-new">
Compaction
</ins></a><ins class="diff-new">
optimizes
that
member
away
if
its
value
contains
just
one
item.
</ins></p></section><section class="informative" id="rdf-conversion"><h3><span class="secno"><ins class="diff-new">
2.4
</ins></span>
RDF
Conversion
</h3>
<p>
<em>
<ins class="diff-new">This
section
is
non-normative.
</ins></em></p>
<p>
JSON-LD
can
be
used
to
<del class="diff-old">losslessly
express
the
RDF
</del>
<ins class="diff-chg">serialize
</ins>
data
<del class="diff-old">model
</del>
<ins class="diff-chg">expressed
in
RDF
</ins>
as
described
in
<del class="diff-old">the
RDF
Concepts
document
</del>
[
<cite>
<a class="bibref" href="#bib-RDF-CONCEPTS">
RDF-CONCEPTS
</a>
</cite>
].
This
ensures
that
data
can
be
round-tripped
from
<ins class="diff-new">and
to
</ins>
any
RDF
<del class="diff-old">syntax,
like
N-Triples
or
TURTLE,
</del>
<ins class="diff-chg">syntax
</ins>
without
any
loss
in
the
fidelity
of
the
data.
<del class="diff-old">Assume
</del>
</p>
<p>
<ins class="diff-chg">For
example,
assume
</ins>
the
following
RDF
input
<ins class="diff-new">serialized
</ins>
in
<del class="diff-old">N-Triples
format:
</del>
<ins class="diff-chg">Turtle
[
</ins><cite><a class="bibref" href="#bib-TURTLE-TR"><ins class="diff-chg">
TURTLE-TR
</ins></a></cite><ins class="diff-chg">
]:
</ins>
</p>
<del class="diff-old">  var data = &quot;
&lt;http://manu.sporny.org/about/#manu&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; \&quot;Manu Sporny\&quot; .\n
&lt;http://manu.sporny.org/about/#manu&gt;
</del>
  <div class="example"><div class="example-title"><span>Example 10</span></div><pre class="example">&lt;http://me.markus-lanthaler.com/&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; &quot;Markus Lanthaler&quot; .
<ins class="diff-chg">&lt;http://me.markus-lanthaler.com/&gt;
</ins>
&lt;http://xmlns.com/foaf/0.1/homepage&gt;
<del class="diff-old">&lt;http://manu.sporny.org/&gt;
.&quot;;
</del>
<ins class="diff-chg">&lt;http://www.markus-lanthaler.com/&gt;
.
</ins>
</pre>
</div>
<p>
<del class="diff-old">A
developer
can
use
</del>
<ins class="diff-chg">Using
</ins>
the
<del class="diff-old">JSON-LD
API
to
</del>
<a href="#convert-from-rdf-algorithm">
<ins class="diff-chg">Convert
from
RDF
Algorithm
</ins></a><ins class="diff-chg">
a
developer
could
</ins>
transform
<del class="diff-old">the
markup
above
</del>
<ins class="diff-chg">this
document
</ins>
into
<del class="diff-old">a
JSON-LD
document:
  function conversionCallback(result)
{
  console.log(&quot;JSON-LD Document: &quot;, result);
};
jsonld.fromRDF(data,
conversionCallback,
{&quot;format&quot;:
&quot;ntriples&quot;});
The
following
</del>
expanded
<del class="diff-old">output
would
be
the
result
of
the
call
above:
</del>
<ins class="diff-chg">JSON-LD:
</ins>
</p>
<del class="diff-old">  [{
  &quot;@id&quot;: &quot;http://manu.sporny.org/about/#manu&quot;,
  &quot;http://xmlns.com/foaf/0.1/name&quot;: [{
    &quot;@value&quot;: &quot;Manu Sporny&quot;
  }],
  &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [{
    &quot;@id&quot;: &quot;http://manu.sporny.org/&quot;
  }]
}]
</del>
  <div class="example"><div class="example-title"><span>Example 11</span></div><pre class="example">[
<ins class="diff-chg">  {
    &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      {
        &quot;@value&quot;: &quot;Markus Lanthaler&quot;
      }
    ],
    &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [
      {
        &quot;@id&quot;: &quot;http://www.markus-lanthaler.com/&quot;
      }
    ]
  }
]
</ins>
</pre>
</div>
<p>
Note
that
the
output
<del class="diff-old">above,
</del>
<ins class="diff-chg">above
</ins>
could
easily
be
compacted
<del class="diff-old">to
produce
the
following
</del>
using
the
technique
outlined
in
the
previous
<del class="diff-old">section:
  {
  &quot;@context&quot;: &quot;http://json-ld.org/contexts/person.jsonld&quot;,
  &quot;@id&quot;: &quot;http://manu.sporny.org/about/#manu&quot;,
  &quot;name&quot;: &quot;Manu Sporny&quot;,
  &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
}
Transforming
</del>
<ins class="diff-chg">section.
It
is
also
possible
to
transform
</ins>
the
<del class="diff-old">node
above
</del>
<ins class="diff-chg">JSON-LD
document
</ins>
back
to
RDF
<del class="diff-old">is
as
simple
as
calling
</del>
<ins class="diff-chg">using
</ins>
the
<del class="diff-old">toRDF()
method:
</del>
<a href="#convert-to-rdf-algorithm">
<ins class="diff-chg">Convert
to
RDF
Algorithm
</ins></a>.
</p>
<del class="diff-old">  var jsonldDocument = ...; // assign the JSON-LD document here
function rdfCallback(quads)
{
  console.log(&quot;RDF Data: &quot;, quads);
};
jsonld.toRDF(jsonldDocument,
rdfCallback);
</del>
</section>
</section>
<section id="conformance">
<h2>
<span class="secno">
3.
</span>
<del class="diff-old">The
Application
Programming
Interface
</del>
<ins class="diff-chg">Conformance
</ins>
</h2>
<p>
<del class="diff-old">This
API
provides
a
clean
mechanism
</del>
<ins class="diff-chg">All
examples
and
notes
as
well
as
sections
marked
as
non-normative
in
this
specification
are
non-normative.
Everything
else
in
this
specification
is
normative.
</ins></p><p><ins class="diff-chg">
The
keywords
</ins><em class="rfc2119" title="must"><ins class="diff-chg">
must
</ins></em>,<em class="rfc2119" title="must not"><ins class="diff-chg">
must
not
</ins></em>,<em class="rfc2119" title="required"><ins class="diff-chg">
required
</ins></em>,<em class="rfc2119" title="should"><ins class="diff-chg">
should
</ins></em>,<em class="rfc2119" title="should not"><ins class="diff-chg">
should
not
</ins></em>,<em class="rfc2119" title="recommended"><ins class="diff-chg">
recommended
</ins></em>,<em class="rfc2119" title="may"><ins class="diff-chg">
may
</ins></em>,<ins class="diff-chg">
and
</ins><em class="rfc2119" title="optional"><ins class="diff-chg">
optional
</ins></em><ins class="diff-chg">
in
this
specification
are
to
be
interpreted
as
described
in
[
</ins><cite><a class="bibref" href="#bib-RFC2119"><ins class="diff-chg">
RFC2119
</ins></a></cite><ins class="diff-chg">
].
</ins></p><p><ins class="diff-chg">
There
are
two
classes
of
products
</ins>
that
<del class="diff-old">enables
developers
</del>
<ins class="diff-chg">can
claim
conformance
</ins>
to
<del class="diff-old">convert
</del>
<ins class="diff-chg">this
specification:
</ins><a class="tref internalDFN" title="json-ld_implementation" href="#dfn-json-ld_implementation">
JSON-LD
<del class="diff-old">data
into
a
</del>
<ins class="diff-chg">Implementations
</ins></a><ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="json-ld_processor" href="#dfn-json-ld_processor"><ins class="diff-chg">
JSON-LD
Processors
</ins></a>.</p><p><ins class="diff-chg">
A
conforming
</ins><dfn title="json-ld_implementation" id="dfn-json-ld_implementation"><ins class="diff-chg">
JSON-LD
Implementation
</ins></dfn><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">variety
</del>
<ins class="diff-chg">system
capable
</ins>
of
<del class="diff-old">output
formats
that
are
easier
to
work
with
</del>
<ins class="diff-chg">transforming
JSON-LD
documents
according
the
algorithms
defined
</ins>
in
<del class="diff-old">various
programming
languages.
If
a
</del>
<ins class="diff-chg">this
specification.
</ins></p><p><ins class="diff-chg">
A
conforming
</ins><dfn title="json-ld_processor" id="dfn-json-ld_processor">
JSON-LD
<del class="diff-old">API
</del>
<ins class="diff-chg">Processor
</ins></dfn>
is
<del class="diff-old">provided
in
</del>
a
<ins class="diff-new">conforming
</ins><a class="tref internalDFN" title="json-ld_implementation" href="#dfn-json-ld_implementation"><ins class="diff-new">
JSON-LD
Implementation
</ins></a><ins class="diff-new">
that
exposes
the
application
</ins>
programming
<del class="diff-old">environment,
</del>
<ins class="diff-chg">interface
(API)
defined
in
this
specification.
</ins></p><p><ins class="diff-chg">
The
algorithms
in
this
specification
are
generally
written
with
more
concern
for
clarity
than
over
efficiency.
Thus,
JSON-LD
Implementations
and
Processors
may
implement
</ins>
the
<del class="diff-old">entirety
of
</del>
<ins class="diff-chg">algorithms
given
in
this
specification
in
any
way
desired,
so
long
as
</ins>
the
<del class="diff-old">following
API
</del>
<ins class="diff-chg">end
result
is
indistinguishable
from
the
result
that
would
be
obtained
by
the
specification's
algorithms.
</ins></p><p><ins class="diff-chg">
This
specification
does
not
define
how
JSON-LD
Implementations
or
Processors
handle
non-conforming
input
documents.
This
implies
that
JSON-LD
Implementations
or
Processors
</ins><em class="rfc2119" title="must not">
must
<ins class="diff-new">not
</ins>
</em>
<del class="diff-old">be
implemented.
</del>
<ins class="diff-chg">attempt
to
correct
malformed
IRIs
or
language
tags;
however,
they
</ins><em class="rfc2119" title="may"><ins class="diff-chg">
may
</ins></em><ins class="diff-chg">
issue
validation
warnings.
</ins>
</p>
<del class="diff-old">3.1
General
Terminology
</del>
<div class="note">
<div class="note-title">
<span>
<del class="diff-old">Issue
</del>
<ins class="diff-chg">Note
</ins>
</span>
</div>
<p class="">
<del class="diff-old">The
intent
of
the
Working
Group
and
the
Editors
</del>
<ins class="diff-chg">Implementers
can
partially
check
their
level
</ins>
of
<del class="diff-old">this
specification
is
</del>
<ins class="diff-chg">conformance
</ins>
to
<del class="diff-old">eventually
align
terminology
used
in
</del>
this
<del class="diff-old">document
with
</del>
<ins class="diff-chg">specification
by
successfully
passing
</ins>
the
<del class="diff-old">terminology
used
in
</del>
<ins class="diff-chg">test
cases
of
</ins>
the
<del class="diff-old">RDF
Concepts
document
to
</del>
<ins class="diff-chg">JSON-LD
test
suite
[
</ins><cite><a class="bibref" href="#bib-JSON-LD-TESTS"><ins class="diff-chg">
JSON-LD-TESTS
</ins></a></cite><ins class="diff-chg">
].
Note,
however,
that
passing
all
</ins>
the
<del class="diff-old">extent
to
which
it
makes
sense
to
do
so.
In
general,
if
there
is
an
analogue
to
terminology
used
in
this
document
</del>
<ins class="diff-chg">tests
</ins>
in
the
<del class="diff-old">RDF
Concepts
document,
the
preference
is
</del>
<ins class="diff-chg">test
suite
does
not
imply
complete
conformance
</ins>
to
<del class="diff-old">use
</del>
<ins class="diff-chg">this
specification.
It
only
implies
that
</ins>
the
<del class="diff-old">terminology
in
</del>
<ins class="diff-chg">implementation
conforms
to
aspects
tested
by
</ins>
the
<del class="diff-old">RDF
Concepts
document.
</del>
<ins class="diff-chg">test
suite.
</ins>
</p>
</div>
</section>
<section id="general-terminology">
<h2>
<span class="secno">
<ins class="diff-new">4.
</ins></span><ins class="diff-new">
General
Terminology
</ins></h2>
<p>
<del class="diff-old">The
</del>
<ins class="diff-chg">This
document
uses
the
</ins>
following
<del class="diff-old">is
an
explanation
of
</del>
<ins class="diff-chg">terms
as
defined
in
JSON
[
</ins><cite><a class="bibref" href="#bib-RFC4627"><ins class="diff-chg">
RFC4627
</ins></a></cite><ins class="diff-chg">
].
Refer
to
</ins>
the
<del class="diff-old">general
terminology
used
</del>
<em>
<ins class="diff-chg">JSON
Grammar
</ins></em><ins class="diff-chg">
section
</ins>
in
<del class="diff-old">this
document:
</del>
<ins class="diff-chg">[
</ins><cite><a class="bibref" href="#bib-RFC4627"><ins class="diff-chg">
RFC4627
</ins></a></cite><ins class="diff-chg">
]
for
formal
definitions.
</ins>
</p>
<dl>
<dt>
<dfn title="json_object" id="dfn-json_object">
JSON
object
</dfn>
</dt>
<dd>
An
object
structure
is
represented
as
a
pair
of
curly
brackets
surrounding
zero
or
more
<del class="diff-old">name-value
</del>
<ins class="diff-chg">key-value
</ins>
pairs.
A
<del class="diff-old">name
</del>
<ins class="diff-chg">key
</ins>
is
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>.
A
single
colon
comes
after
each
<del class="diff-old">name,
</del>
<ins class="diff-chg">key,
</ins>
separating
the
<del class="diff-old">name
</del>
<ins class="diff-chg">key
</ins>
from
the
value.
A
single
comma
separates
a
value
from
a
following
<del class="diff-old">name.
The
names
within
an
object
should
be
unique.
</del>
<ins class="diff-chg">key.
</ins>
</dd>
<dt>
<dfn title="array" id="dfn-array">
array
</dfn>
</dt>
<dd>
An
array
<ins class="diff-new">structure
</ins>
is
represented
as
square
brackets
surrounding
zero
or
more
values
<del class="diff-old">that
</del>
<ins class="diff-chg">(or
elements).
Elements
</ins>
are
separated
by
commas.
<ins class="diff-new">In
JSON,
an
array
is
an
</ins><em><ins class="diff-new">
ordered
</ins></em><ins class="diff-new">
sequence
of
zero
or
more
values.
While
JSON-LD
uses
the
same
array
representation
as
JSON,
the
collection
is
</ins><em><ins class="diff-new">
unordered
</ins></em><ins class="diff-new">
by
default.
While
order
is
preserved
in
regular
JSON
arrays,
it
is
not
in
regular
JSON-LD
arrays
unless
specific
markup
is
provided
(see
</ins><a href="#sets-and-lists"></a><ins class="diff-new">
).
</ins>
</dd>
<dt>
<dfn title="string" id="dfn-string">
string
</dfn>
</dt>
<dd>
A
string
is
a
sequence
of
zero
or
more
Unicode
<del class="diff-old">(UTF-8)
</del>
characters,
wrapped
in
double
quotes,
using
backslash
escapes
(if
necessary).
A
character
is
represented
as
a
single
character
string.
</dd>
<dt>
<dfn title="number" id="dfn-number">
number
</dfn>
</dt>
<dd>
A
number
is
similar
to
that
used
in
most
programming
languages,
except
that
the
octal
and
hexadecimal
formats
are
not
used
and
that
leading
zeros
are
not
allowed.
</dd>
<dt>
<dfn title="true" id="dfn-true">
true
</dfn>
and
<dfn title="false" id="dfn-false">
false
</dfn>
</dt>
<dd>
Values
that
are
used
to
express
one
of
two
possible
boolean
states.
</dd>
<dt>
<dfn title="null" id="dfn-null">
null
</dfn>
</dt>
<dd>
The
<del class="diff-old">use
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a><ins class="diff-chg">
value.
A
key-value
pair
in
the
</ins><code><ins class="diff-chg">
@context
</ins></code><ins class="diff-chg">
where
the
value,
or
the
</ins><code><ins class="diff-chg">
@id
</ins></code>
of
the
<ins class="diff-new">value,
is
</ins>
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>
<del class="diff-old">value
within
</del>
<ins class="diff-chg">explicitly
decouples
a
term's
association
with
an
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>.<ins class="diff-chg">
A
key-value
pair
in
the
body
of
a
</ins>
JSON-LD
<ins class="diff-new">document
whose
value
</ins>
is
<del class="diff-old">used
to
ignore
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a><ins class="diff-chg">
has
the
same
meaning
as
if
the
key-value
pair
was
not
defined.
If
</ins><code><ins class="diff-chg">
@value
</ins></code>,<code><ins class="diff-chg">
@list
</ins></code>,
or
<del class="diff-old">reset
values.
</del>
<code>
<ins class="diff-chg">@set
</ins></code><ins class="diff-chg">
is
set
to
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
in
expanded
form,
then
the
entire
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
is
ignored.
</ins>
</dd>
</dl>
<p>
<ins class="diff-new">Furthermore,
the
following
terminology
is
used
throughout
this
document:
</ins></p><dl>
<dt>
<dfn title="keyword" id="dfn-keyword">
keyword
</dfn>
</dt>
<dd>
A
JSON
key
that
is
specific
to
JSON-LD,
specified
in
the
JSON-LD
Syntax
specification
[
<cite>
<a class="bibref" href="#bib-JSON-LD">
JSON-LD
</a>
</cite>
]
in
the
section
titled
<cite>
<a href="../json-ld-syntax/#syntax-tokens-and-keywords">
Syntax
Tokens
and
Keywords
</a>
</cite>.
</dd>
<dt>
<dfn title="context" id="dfn-context">
context
</dfn>
</dt>
<dd>
A
a
set
of
rules
for
interpreting
a
JSON-LD
document
as
specified
in
<cite>
<a href="../json-ld-syntax/#the-context">
The
Context
</a>
</cite>
of
the
[
<cite>
<a class="bibref" href="#bib-JSON-LD">
JSON-LD
</a>
</cite>
]
specification.
</dd>
<dt>
<del class="diff-old">IRI
An
Internationalized
Resource
Identifier
as
described
in
[
RFC3987
].
Linked
Data
A
set
of
documents,
each
containing
a
representation
of
a
linked
data
graph
.
linked
data
graph
</del>
<dfn title="json-ld_document" id="dfn-json-ld_document">
<ins class="diff-chg">JSON-LD
document
</ins>
</dfn>
</dt>
<dd>
<del class="diff-old">An
unordered
labeled
directed
graph,
where
nodes
are
IRIs
or
Blank
Nodes
,
or
other
values.
</del>
A
<del class="diff-old">linked
data
graph
</del>
<a class="tref internalDFN" title="json-ld_document" href="#dfn-json-ld_document">
<ins class="diff-chg">JSON-LD
document
</ins>
</a>
is
a
<del class="diff-old">generalized
representation
</del>
<ins class="diff-chg">serialization
</ins>
of
a
<del class="diff-old">RDF
graph
</del>
<ins class="diff-chg">collection
of
</ins><a class="tref internalDFN" title="json-ld_graph" href="#dfn-json-ld_graph"><ins class="diff-chg">
JSON-LD
graphs
</ins>
</a>
<del class="diff-old">as
defined
in
[
RDF-CONCEPTS
</del>
<ins class="diff-chg">and
comprises
exactly
one
</ins><a class="tref internalDFN" title="default_graph" href="#dfn-default_graph"><ins class="diff-chg">
default
graph
</ins>
</a>
<del class="diff-old">].
</del>
<ins class="diff-chg">and
zero
or
more
</ins><a class="tref internalDFN" title="named_graph" href="#dfn-named_graph"><ins class="diff-chg">
named
graphs
</ins></a>.
</dd>
<dt>
<dfn title="named_graph" id="dfn-named_graph">
named
graph
</dfn>
</dt>
<dd>
A
<del class="diff-old">linked
data
</del>
<ins class="diff-chg">named
</ins>
graph
<del class="diff-old">that
</del>
is
<del class="diff-old">identified
by
</del>
<ins class="diff-chg">a
pair
consisting
of
</ins>
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">or
</ins><a class="tref internalDFN" title="blank_node" href="#dfn-blank_node"><ins class="diff-chg">
blank
node
</ins></a><ins class="diff-chg">
(the
</ins>
<dfn title="graph_name" id="dfn-graph_name">
graph
name
</dfn>
<del class="diff-old">The
IRI
identifying
</del>
<ins class="diff-chg">)
and
</ins>
a
<del class="diff-old">named
</del>
<a class="tref internalDFN" title="json-ld_graph" href="#dfn-json-ld_graph">
<ins class="diff-chg">JSON-LD
</ins>
graph
</a>.
</dd>
<dt>
<dfn title="default_graph" id="dfn-default_graph">
default
graph
</dfn>
</dt>
<dd>
<del class="diff-old">When
executing
an
algorithm,
the
graph
where
data
should
be
placed
if
a
named
graph
is
not
specified.
node
A
piece
of
information
that
is
represented
in
a
linked
data
</del>
<ins class="diff-chg">The
default
</ins>
graph
<del class="diff-old">.
node
definition
A
JSON
object
used
to
represent
a
node
and
one
or
more
properties
of
that
node.
A
JSON
object
</del>
is
<del class="diff-old">a
node
definition
if
it
does
not
contain
</del>
the
<del class="diff-old">keys
@value
,
@list
or
@set
and
it
has
one
or
more
keys
other
than
@id
.
node
reference
A
JSON
object
used
to
reference
a
node
having
</del>
only
<del class="diff-old">the
@id
key.
blank
node
A
node
in
the
linked
data
</del>
graph
<del class="diff-old">that
does
not
contain
a
de-referenceable
identifier
because
it
is
either
ephemeral
in
nature
or
does
not
contain
information
that
needs
to
be
linked
to
from
outside
of
the
linked
data
graph.
A
blank
node
is
assigned
an
identifier
starting
with
the
prefix
_:
.
property
The
IRI
label
of
an
edge
</del>
in
a
<del class="diff-old">linked
data
</del>
<ins class="diff-chg">JSON-LD
document
which
has
no
</ins><a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
graph
<ins class="diff-new">name
</ins>
</a>.
</dd>
<dt>
<del class="diff-old">subject
A
node
in
a
linked
data
</del>
<dfn title="json-ld_graph" id="dfn-json-ld_graph">
<ins class="diff-chg">JSON-LD
</ins>
graph
<del class="diff-old">with
at
least
one
outgoing
edge,
related
to
an
object
node
through
a
property
.
object
</del>
</dfn>
</dt>
<dd>
A
<del class="diff-old">node
in
</del>
<ins class="diff-chg">labeled
directed
graph,
i.e.,
</ins>
a
<del class="diff-old">linked
data
graph
with
at
least
one
incoming
edge.
quad
A
piece
</del>
<ins class="diff-chg">set
</ins>
of
<del class="diff-old">information
that
contains
four
items;
a
subject
,
a
property
,
an
object
,
and
a
graph
name
.
literal
An
object
expressed
as
a
value
such
as
a
string,
number
or
in
expanded
form.
3.2
JsonLdProcessor
The
JSON-LD
processor
interface
is
the
high-level
programming
structure
that
developers
use
to
access
the
JSON-LD
transformation
methods.
Note
The
JSON-LD
API
signatures
are
the
same
across
all
programming
languages.
Due
to
the
fact
that
asynchronous
programming
is
uncommon
in
certain
languages,
developers
may
implement
a
processor
with
a
synchronous
interface
instead.
In
that
case,
the
callback
parameter
must
not
be
included
and
the
result
must
be
returned
as
a
return
value
instead.
    ]
interface  {
};
3.2.1
Methods
compact
Compacts
</del>
<a class="tref internalDFN" title="node" href="#dfn-node">
<ins class="diff-chg">nodes
</ins>
</a>
<del class="diff-old">the
given
input
using
the
context
according
to
the
steps
in
the
Compaction
Algorithm
.
The
input
must
be
copied,
compacted
and
returned
if
there
are
no
errors.
If
the
compaction
fails,
an
appropriate
error
must
be
returned
via
the
callback.
INVALID_SYNTAX
A
general
syntax
error
was
detected
in
the
@context
.
For
example,
if
a
@type
key
maps
to
anything
other
than
@id
or
an
absolute
IRI
</del>
<ins class="diff-chg">connected
by
</ins><a class="tref internalDFN" title="edge" href="#dfn-edge"><ins class="diff-chg">
edges
</ins>
</a>,
<del class="diff-old">this
error
would
be
returned
via
the
callback
.
LOAD_ERROR
There
was
a
problem
encountered
loading
a
remote
context.
LOSSY_COMPACTION
The
compaction
would
lead
to
a
loss
of
information,
such
</del>
as
<del class="diff-old">a
@language
value.
CONFLICTING_DATATYPES
The
target
datatype
</del>
specified
in
the
<del class="diff-old">coercion
rule
and
the
datatype
for
the
typed
literal
do
not
match.
LIST_OF_LISTS_DETECTED
A
list
of
lists
was
detected.
The
list
of
lists
feature
is
not
supported
in
this
version
of
JSON-LD
due
to
the
algorithmic
complexity
associated
with
conversion
to
RDF.
Parameter
Type
Nullable
Optional
Description
input
</del>
<cite>
<del class="diff-old">object
or
object[]
or
IRI
</del>
<a href="../json-ld-syntax/#data-model">
<ins class="diff-chg">Data
Model
</ins>
</a>
<del class="diff-old">✘
✘
The
JSON-LD
object
or
array
</del>
</cite>
<ins class="diff-chg">section
</ins>
of
<del class="diff-old">JSON-LD
objects
to
perform
the
compaction
upon
or
an
IRI
referencing
</del>
the
JSON-LD
<del class="diff-old">document
to
compact.
context
object
or
IRI
✘
✘
The
context
to
use
when
compacting
the
input
;
either
in
the
form
of
an
JSON
object
or
as
IRI
.
callback
JsonLdCallback
✘
✘
A
callback
that
is
called
when
processing
is
complete
on
the
given
input
.
options
JsonLdOptions
✔
✔
A
set
of
options
that
may
affect
the
expansion
algorithm
such
as,
e.g.,
the
input
document's
base
IRI
.
This
also
includes
optimize
,
which
if
set
will
cause
processor-specific
optimization.
Return
type:
</del>
<ins class="diff-chg">syntax
specification
[
</ins><cite>
<del class="diff-old">void
</del>
<a class="bibref" href="#bib-JSON-LD">
<ins class="diff-chg">JSON-LD
</ins>
</a>
</cite>
<ins class="diff-chg">].
</ins>
</dd>
<dt>
<del class="diff-old">expand
</del>
<dfn title="edge" id="dfn-edge">
<ins class="diff-chg">edge
</ins></dfn>
</dt>
<dd>
<del class="diff-old">Expands
</del>
<ins class="diff-chg">Every
</ins><a class="tref internalDFN" title="edge" href="#dfn-edge"><ins class="diff-chg">
edge
</ins>
</a>
<del class="diff-old">the
given
input
according
to
the
steps
in
the
Expansion
Algorithm
.
The
input
must
be
copied,
expanded
and
returned
if
there
are
no
errors.
If
the
expansion
fails,
an
appropriate
error
must
be
returned
via
the
callback.
INVALID_SYNTAX
A
general
syntax
error
was
detected
in
the
@context
.
For
example,
if
a
@type
key
maps
to
anything
other
than
@id
or
an
absolute
IRI
,
this
error
type
will
be
set
in
the
error
sent
to
the
callback
.
LOAD_ERROR
There
was
a
problem
encountered
loading
</del>
<ins class="diff-chg">has
</ins>
a
<del class="diff-old">remote
context.
LIST_OF_LISTS_DETECTED
A
list
of
lists
was
detected.
The
list
of
lists
feature
is
not
supported
in
this
version
of
JSON-LD
due
to
the
algorithmic
complexity
</del>
<ins class="diff-chg">direction
</ins>
associated
with
<del class="diff-old">conversion
to
RDF.
Parameter
Type
Nullable
Optional
Description
input
object
or
object[]
or
IRI
✘
✘
The
JSON-LD
object
or
array
of
JSON-LD
objects
to
perform
the
expansion
upon
or
</del>
<ins class="diff-chg">it
and
is
labeled
with
</ins>
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
<del class="diff-old">referencing
the
JSON-LD
document
to
expand.
context
object
</del>
or
<del class="diff-old">IRI
✔
✘
An
optional
external
context
to
use
additionally
to
the
context
embedded
in
input
when
expanding
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifier
</ins></a>.<ins class="diff-chg">
Within
</ins>
the
<del class="diff-old">input
.
callback
JsonLdCallback
✘
✘
A
callback
that
is
</del>
<ins class="diff-chg">JSON-LD
syntax
these
edge
labels
are
</ins>
called
<del class="diff-old">when
processing
is
complete
on
the
given
input
.
options
JsonLdOptions
</del>
<dfn title="property" id="dfn-property">
<ins class="diff-chg">properties
</ins></dfn>.<ins class="diff-chg">
Whenever
possible,
an
</ins><a class="tref internalDFN" title="edge" href="#dfn-edge"><ins class="diff-chg">
edge
</ins>
</a>
<del class="diff-old">✔
✔
A
set
of
options
that
may
</del>
<em class="rfc2119" title="should">
<ins class="diff-chg">should
</ins>
</em>
<del class="diff-old">affect
the
expansion
algorithm
such
as,
e.g.,
the
input
document's
base
</del>
<ins class="diff-chg">be
labeled
with
an
</ins>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
<del class="diff-old">Return
type:
void
</del>
</dd>
<dt>
<del class="diff-old">fromRDF
</del>
<dfn title="node" id="dfn-node">
<ins class="diff-chg">node
</ins></dfn>
</dt>
<dd>
<del class="diff-old">Creates
a
JSON-LD
document
given
an
set
of
Quads
.
Parameter
Type
Nullable
Optional
Description
input
Quad
[]
✘
✘
A
set
of
linked
data
graph
s
represented
as
an
array
of
Quads
.
callback
JsonLdCallback
</del>
<ins class="diff-chg">Every
</ins><a class="tref internalDFN" title="node" href="#dfn-node"><ins class="diff-chg">
node
</ins>
</a>
<del class="diff-old">✘
✘
A
callback
that
is
called
when
processing
</del>
is
<del class="diff-old">complete
on
the
given
input
.
options
JsonLdOptions
✔
✔
A
set
of
options
that
will
affect
the
algorithm.
This
includes
notType
,
which
if
set
to
true
causes
the
resulting
document
to
use
rdf:type
as
a
property,
instead
of
@type
.
Return
type:
void
toRDF
Processes
the
input
according
to
the
Convert
to
RDF
Algorithm
,
calling
the
provided
callback
for
each
Quad
generated.
INVALID_SYNTAX
A
general
syntax
error
was
detected
in
the
@context
.
For
example,
if
a
@type
key
maps
to
anything
other
than
@id
or
</del>
an
<del class="diff-old">absolute
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>,
<del class="diff-old">this
error
will
be
returned.
LOAD_ERROR
There
was
</del>
a
<del class="diff-old">problem
encountered
loading
</del>
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
<ins class="diff-chg">blank
node
</ins></a>,
a
<del class="diff-old">remote
context.
LIST_OF_LISTS_DETECTED
A
list
of
lists
was
detected.
This
is
not
supported
in
this
version
of
JSON-LD.
Parameter
Type
Nullable
Optional
Description
input
object
or
object[]
or
IRI
✘
✘
The
JSON-LD
object
or
array
of
</del>
<a class="tref internalDFN" title="json-ld_value" href="#dfn-json-ld_value">
JSON-LD
<del class="diff-old">objects
to
convert
to
RDF
</del>
<ins class="diff-chg">value
</ins></a>,
or
a
<del class="diff-old">IRI
referencing
the
JSON-LD
document
to
convert
to
RDF.
callback
QuadCallback
✘
✘
A
callback
that
is
called
when
a
Quad
is
created
from
processing
the
given
input
.
options
JsonLdOptions
✔
✔
</del>
<a class="tref internalDFN" title="list" href="#dfn-list">
<ins class="diff-chg">list
</ins></a>.</dd><dt>
<del class="diff-old">A
set
of
options
that
may
affect
the
conversion
to
RDF
such
as,
e.g.,
the
input
document's
base
</del>
<dfn title="iri" id="dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">.
Return
type:
void
3.3
Callbacks
Issue
153
Developers
should
note
that
the
details
of
error
handling
and
conformance
handling
are
being
actively
debated.
JSON-LD
processors
utilize
a
variety
of
callbacks
in
order
to
return
information
in
an
asynchronous
manner
to
calling
applications.
This
section
details
the
parameters
sent
to
those
callbacks
as
well
as
the
desired
operation
of
the
callbacks.
3.3.1
JsonLdProcessingError
The
JsonLdError
type
is
used
to
encapsulate
a
variety
of
parameters
that
outline
the
cause
of
a
particular
JsonLdProcessor
error.
       {
};
Dictionary
JsonLdProcessingError
Members
operation
of
type
string
a
string
representing
the
operation
that
was
being
performed
when
the
conformance
issue
was
raised.
Valid
values
for
the
string
include
compact
,
expand
,
toRDF
,
and
fromRDF
.
source
of
type
array
of
object
or
object
</del>
</dfn>
</dt>
<dd>
An
<del class="diff-old">object
reference
to
the
original
JSON-LD
document
being
processed.
sourceKey
of
type
string
The
key
value
associated
with
the
value
that
triggered
the
conformance
issue.
sourceValue
of
type
object
or
object[]
or
string
or
number
The
value
that
triggered
the
conformance
issue.
type
of
type
string
a
string
representing
the
particular
error
type,
such
as
LIST_OF_LISTS_DETECTED
,
as
described
in
the
various
algorithms
in
this
document.
3.3.2
JsonLdCallback
The
JsonLdCallback
is
used
to
return
a
processed
JSON-LD
representation
as
the
result
of
processing
an
API
method.
      ]
interface  {
};
Methods
processingComplete
This
callback
is
invoked
when
processing
is
complete.
Parameter
Type
Nullable
Optional
Description
error
JsonLdProcessingError
✘
✘
If
the
value
is
null
,
then
no
error
occurred.
If
the
value
is
non-
null
,
a
processing
error
occurred
and
the
details
will
be
contained
within
the
error
object.
document
object
or
object
[]
✘
✘
The
processed
JSON-LD
document.
Return
type:
void
3.3.3
QuadCallback
The
QuadCallback
is
called
whenever
the
processor
generates
a
quad
during
processing.
      ]
interface  {
};
Methods
quad
This
callback
is
invoked
whenever
a
quad
is
generated
by
the
processor.
Parameter
Type
Nullable
Optional
Description
error
JsonLdProcessingError
✘
✘
If
the
value
is
null
,
then
no
error
occurred.
If
the
value
is
non-
null
,
a
processing
error
occurred
and
the
details
will
be
contained
within
the
error
object.
quad
Quad
✘
✘
If
there
is
no
error,
the
quad
that
was
generated.
Return
type:
void
3.3.4
ConformanceCallback
The
ConformanceCallback
may
be
specified
in
the
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<del class="diff-old">JsonLdOptions
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
</a>
<del class="diff-old">via
the
conformanceCallback
parameter.
If
specified,
the
callback
is
called
whenever
a
recoverable
conformance
issue
is
detected.
The
developer
may
then
determine
whether
or
not
processing
should
continue
based
on
the
type
of
conformance
issue.
      ]
interface  {
};
Methods
issue
This
callback
</del>
<ins class="diff-chg">(Internationalized
Resource
Identifier)
</ins>
is
<del class="diff-old">invoked
when
</del>
a
<del class="diff-old">conformance
issue
is
detected
by
the
JSON-LD
processor.
Parameter
Type
Nullable
Optional
Description
issue
JsonLdProcessingError
✘
✘
Details
about
the
conformance
issue.
callback
function
✘
✘
A
function
that
must
be
called
when
the
program
has
determined
how
to
respond
to
the
conformance
issue.
A
single
parameter
must
be
passed
to
the
callback.
The
value
of
the
parameter
should
be
null
if
processing
should
continue
by
acting
as
if
the
key-value
</del>
<ins class="diff-chg">string
</ins>
that
<del class="diff-old">triggered
the
issue
never
existed.
The
issue
should
be
passed
</del>
<ins class="diff-chg">conforms
</ins>
to
the
<del class="diff-old">callback
without
modification
if
processing
should
stop.
Return
type:
</del>
<ins class="diff-chg">syntax
defined
in
[
</ins><cite>
<del class="diff-old">void
</del>
<a class="bibref" href="#bib-RFC3987">
<ins class="diff-chg">RFC3987
</ins>
</a>
</cite>
<ins class="diff-chg">].
</ins>
</dd>
<dt>
<del class="diff-old">3.4
Data
Structures
This
section
describes
datatype
definitions
used
within
the
JSON-LD
API.
3.4.1
</del>
<dfn title="absolute_iri" id="dfn-absolute_iri">
<ins class="diff-chg">absolute
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">The
IRI
datatype
is
a
string
representation
of
an
</del>
</dfn>
</dt>
<dd>
<ins class="diff-new">An
absolute
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">.
typedef
DOMString
IRI
;
This
datatype
indicates
that
the
string
</del>
is
<del class="diff-old">interpreted
as
an
Internationalized
Resource
Identifier
</del>
<ins class="diff-chg">defined
in
</ins>
[
<cite>
<a class="bibref" href="#bib-RFC3987">
RFC3987
</a>
</cite>
]
<del class="diff-old">identifying
a
document,
which
when
parsed
as
JSON
yields
either
a
JSON
object
or
array
.
3.4.2
JsonLdOptions
The
JsonLdOptions
type
is
used
to
pass
various
options
to
the
JsonLdProcessor
methods.
     {
};
Dictionary
JsonLdOptions
Members
base
of
type
IRI
,
nullable
The
Base
IRI
to
use
when
expanding
the
document.
This
overrides
the
value
of
input
if
it
is
</del>
<ins class="diff-chg">containing
</ins>
a
<del class="diff-old">IRI
.
If
not
specified
and
</del>
<em>
<del class="diff-old">input
</del>
<ins class="diff-chg">scheme
</ins>
</em>
<del class="diff-old">is
not
an
IRI
,
the
base
IRI
defaults
to
the
current
document
IRI
if
in
a
browser
context,
or
the
empty
string
if
there
is
no
document
context.
compactArrays
of
type
boolean
,
defaulting
to
true
If
set
to
true
,
the
JSON-LD
processor
replaces
arrays
with
just
one
element
with
that
element
during
compaction.
If
set
to
false
,
all
arrays
will
remain
arrays
even
if
they
have
just
one
element.
conformanceCallback
of
type
function
,
defaulting
to
null
The
purpose
of
this
option
is
to
instruct
the
processor
about
whether
or
not
it
should
continue
processing.
If
the
value
is
null
,
the
processor
should
ignore
any
key-value
pair
associated
</del>
<ins class="diff-chg">along
</ins>
with
<del class="diff-old">any
recoverable
conformance
issue
and
continue
processing.
More
details
about
this
feature
can
be
found
in
the
ConformanceCallback
section.
flatten
of
type
boolean
,
defaulting
to
false
If
set
to
</del>
a
<del class="diff-old">value
that
is
not
false
,
the
JSON-LD
processor
must
modify
the
output
of
the
Compaction
Algorithm
or
the
Expansion
Algorithm
by
coalescing
all
properties
associated
with
each
subject
via
the
Flattening
Algorithm
.
The
value
of
flatten
must
</del>
<em>
<ins class="diff-chg">path
</ins>
</em>
<del class="diff-old">be
either
an
IRI
value
representing
the
name
of
the
graph
to
flatten,
or
true
.
If
the
value
is
true
,
then
the
first
graph
encountered
in
the
input
document
is
selected
and
flattened.
optimize
of
type
boolean
,
defaulting
to
false
If
set
to
true
,
the
JSON-LD
processor
is
allowed
to
optimize
the
output
of
the
Compaction
Algorithm
to
produce
even
compacter
representations.
The
algorithm
for
compaction
optimization
is
beyond
the
scope
of
this
specification
</del>
and
<del class="diff-old">thus
not
defined.
Consequently,
different
implementations
may
</del>
<ins class="diff-chg">optional
</ins><em><ins class="diff-chg">
query
</ins>
</em>
<del class="diff-old">implement
different
optimization
algorithms.
useNativeTypes
of
type
boolean
,
defaulting
to
true
If
set
to
true
,
the
JSON-LD
processor
will
try
to
convert
datatyped
literals
to
JSON
native
types
instead
of
using
the
expanded
object
form
when
converting
from
RDF
.
xsd:boolean
values
will
be
converted
to
true
or
false
.
xsd:integer
</del>
and
<del class="diff-old">xsd:double
values
will
be
converted
to
JSON
numbers
.
</del>
<ins class="diff-chg">fragment
segments.
</ins>
</dd>
<dt>
<del class="diff-old">useRdfType
of
type
boolean
,
defaulting
to
false
If
set
to
true
,
the
JSON-LD
processor
will
use
the
expanded
rdf:type
</del>
<dfn title="relative_iri" id="dfn-relative_iri">
<ins class="diff-chg">relative
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">as
the
property
instead
of
@type
when
converting
from
RDF
.
The
following
data
structures
are
used
for
representing
data
about
RDF
quads.
They
are
used
for
normalization,
and
RDF
conversion
.
3.4.3
Quad
The
Quad
interface
represents
an
RDF
Quad.
See
[
RDF-CONCEPTS
]
definition
for
RDF
triple
,
which
most
closely
aligns
to
Quad
.
    ]
interface  {
};
Attributes
graph
of
type
Node
,
readonly,
nullable
If
present,
the
name
associated
with
the
Quad
identifying
it
as
a
member
of
a
named
graph
.
If
it
is
missing,
the
quad
is
a
member
of
the
default
graph
.
Issue
125
This
element
is
at
risk,
and
may
be
removed.
object
of
type
Node
,
readonly
The
object
associated
with
the
Quad
.
</del>
<del class="diff-old">property
of
type
Node
,
readonly
The
property
associated
with
the
Quad
.
Within
JSON-LD,
an
RDF
predicate
</del>
</dfn>
<del class="diff-old">is
refered
to
as
a
property
</del>
<del class="diff-old">subject
of
type
Node
,
readonly
</del>
</dt>
<dd>
<del class="diff-old">The
subject
associated
with
the
Quad
.
3.4.4
Node
Node
is
the
base
class
of
</del>
<ins class="diff-chg">A
relative
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">,
BlankNode
,
and
Literal
.
It
</del>
is
<del class="diff-old">the
IDL
representation
of
a
linked
data
graph
node
.
    ]
interface  {
};
3.4.5
</del>
<ins class="diff-chg">an
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">A
node
</del>
that
is
<del class="diff-old">an
</del>
<ins class="diff-chg">relative
some
other
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri"><ins class="diff-chg">
absolute
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">.
    ]
interface  {
};
Attributes
value
of
type
DOMString
</del>
</a>
<del class="diff-old">,
readonly
The
IRI
identifier
</del>
<ins class="diff-chg">;
in
the
case
</ins>
of
<ins class="diff-new">JSON-LD
this
is
</ins>
the
<del class="diff-old">node
as
a
[
UNICODE
]
string.
</del>
<ins class="diff-chg">base
location
of
the
document.
</ins>
</dd>
<dt>
<dfn title="blank_node" id="dfn-blank_node">
<ins class="diff-chg">blank
node
</ins></dfn>
<del class="diff-old">3.4.6
Blank
Node
</del>
</dt>
<dd>
A
<a class="tref internalDFN" title="node" href="#dfn-node">
node
</a>
in
<del class="diff-old">the
linked
data
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="json-ld_graph" href="#dfn-json-ld_graph"><ins class="diff-chg">
JSON-LD
</ins>
graph
</a>
that
does
not
contain
a
<del class="diff-old">de-reference-able
</del>
<ins class="diff-chg">de-referenceable
</ins>
identifier
because
it
is
either
ephemeral
in
nature
or
does
not
contain
information
that
needs
to
be
linked
to
from
outside
of
the
<del class="diff-old">linked
data
graph
.
A
</del>
<ins class="diff-chg">JSON-LD
graph.
</ins></dd><dt><dfn title="blank_node_identifier" id="dfn-blank_node_identifier">
blank
node
<del class="diff-old">is
assigned
an
identifier
starting
with
the
prefix
_:
and
an
implementation
dependent,
auto-generated
suffix
that
is
unique
to
all
information
associated
with
the
particular
blank
node.
    ]
interface  {
};
Attributes
</del>
identifier
<del class="diff-old">of
type
DOMString
</del>
</dfn>
<del class="diff-old">,
readonly
</del>
</dt>
<dd>
<del class="diff-old">The
temporary
identifier
of
the
</del>
<ins class="diff-chg">A
</ins>
blank
node
<del class="diff-old">.
The
</del>
identifier
<del class="diff-old">must
not
be
relied
upon
in
any
way
between
two
separate
processing
runs
of
the
same
document
or
with
</del>
<ins class="diff-chg">is
</ins>
a
<del class="diff-old">different
document.
Note
Developers
and
authors
must
not
assume
</del>
<ins class="diff-chg">string
</ins>
that
<del class="diff-old">the
value
of
</del>
<ins class="diff-chg">can
be
used
as
an
identifier
for
</ins>
a
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
<del class="diff-old">will
remain
the
same
between
two
processing
runs.
BlankNode
values
are
only
valid
for
the
most
recent
processing
run
on
</del>
<ins class="diff-chg">within
</ins>
the
<ins class="diff-new">scope
of
a
JSON-LD
</ins>
document.
<ins class="diff-chg">Blank
node
identifiers
begin
with
</ins>
<code>
<del class="diff-old">BlankNode
values
will
often
be
generated
differently
by
different
processors.
Note
Implementers
must
ensure
that
</del>
<ins class="diff-chg">_:
</ins></code>.</dd><dt>
<del class="diff-old">BlankNode
</del>
<dfn title="json-ld_value" id="dfn-json-ld_value">
<ins class="diff-chg">JSON-LD
value
</ins></dfn>
</dt>
<dd>
<ins class="diff-new">A
</ins><a class="tref internalDFN" title="json-ld_value" href="#dfn-json-ld_value"><ins class="diff-new">
JSON-LD
value
</ins>
</a>
<del class="diff-old">values
are
unique
within
the
current
environment,
two
BlankNodes
</del>
<ins class="diff-chg">is
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
a
</ins><a class="tref internalDFN" title="number" href="#dfn-number"><ins class="diff-chg">
number
</ins></a>,<a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-chg">
true
</ins>
</a>
<del class="diff-old">are
considered
equal
if,
and
only
if,
their
values
are
strictly
equal.
</del>
<ins class="diff-chg">or
</ins><a class="tref internalDFN" title="false" href="#dfn-false"><ins class="diff-chg">
false
</ins></a>,<ins class="diff-chg">
a
</ins><a class="tref internalDFN" title="typed_value" href="#dfn-typed_value"><ins class="diff-chg">
typed
value
</ins></a>,<ins class="diff-chg">
or
a
</ins><a class="tref internalDFN" title="language-tagged_string" href="#dfn-language-tagged_string"><ins class="diff-chg">
language-tagged
string
</ins></a>.</dd><dt>
<dfn title="typed_value" id="dfn-typed_value">
<ins class="diff-chg">typed
value
</ins></dfn>
<del class="diff-old">3.4.7
Literal
Literals
represent
values
such
as
numbers,
dates
and
strings
in
RDF
data.
</del>
</dt>
<dd>
A
<del class="diff-old">Literal
</del>
<a class="tref internalDFN" title="typed_value" href="#dfn-typed_value">
<ins class="diff-chg">typed
value
</ins>
</a>
<del class="diff-old">is
comprised
</del>
<ins class="diff-chg">consists
</ins>
of
<del class="diff-old">three
attributes:
</del>
a
<del class="diff-old">lexical
form
of
the
value
an
optional
language
tag
</del>
<ins class="diff-chg">value,
which
is
</ins>
a
<del class="diff-old">datatype
specified
by
</del>
<ins class="diff-chg">string,
and
a
type,
which
is
</ins>
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</dd>
<dt>
<del class="diff-old">Literals
representing
plain
text
in
</del>
<dfn title="language-tagged_string" id="dfn-language-tagged_string">
<ins class="diff-chg">language-tagged
string
</ins></dfn></dt><dd><ins class="diff-chg">
A
</ins><a class="tref internalDFN" title="language-tagged_string" href="#dfn-language-tagged_string"><ins class="diff-chg">
language-tagged
string
</ins></a><ins class="diff-chg">
consists
of
</ins>
a
<del class="diff-old">natural
language
may
have
</del>
<ins class="diff-chg">string
and
</ins>
a
<ins class="diff-chg">non-empty
</ins>
language
tag
<del class="diff-old">specified
by
a
string
token,
</del>
as
<del class="diff-old">specified
in
</del>
<ins class="diff-chg">defined
by
</ins>
[
<cite>
<a class="bibref" href="#bib-BCP47">
BCP47
</a>
</cite>
<del class="diff-old">],
normalized
to
lowercase
(e.g.,
'en'
,
'fr'
,
'en-gb'
).
They
also
have
a
datatype
attribute
such
as
xsd:string
.
If
unspecified,
the
datatype
defaults
</del>
<ins class="diff-chg">].
The
language
tag
must
be
well-formed
according
</ins>
to
<del class="diff-old">xsd:string
.
Literals
representing
values
with
a
specific
datatype,
such
as
the
integer
72,
may
have
a
datatype
attribute
specified
in
the
form
of
a
IRI
(e.g.,
xsd:integer
).
See[
RDF-CONCEPTS
]
definition
for
literal
.
      ]
interface  {
};
Attributes
datatype
of
type
IRI
</del>
<ins class="diff-chg">section
</ins><a href="http://tools.ietf.org/html/bcp47#section-2.2.9"><ins class="diff-chg">
2.2.9
</ins>
</a>
<del class="diff-old">,
readonly,
nullable
An
optional
datatype
identified
by
a
IRI
.
language
</del>
of
<del class="diff-old">type
DOMString
,
readonly,
nullable
An
optional
language
tag
as
defined
in
</del>
[
<cite>
<a class="bibref" href="#bib-BCP47">
BCP47
</a>
</cite>
],
<ins class="diff-new">and
</ins><em class="rfc2119" title="must"><ins class="diff-new">
must
</ins></em><ins class="diff-new">
be
</ins>
normalized
to
lowercase.
</dd>
<dt>
<del class="diff-old">value
of
type
DOMString
</del>
<dfn title="list" id="dfn-list">
<ins class="diff-chg">list
</ins></dfn>
<del class="diff-old">,
readonly
</del>
</dt>
<dd>
<del class="diff-old">The
lexical
form
</del>
<ins class="diff-chg">A
</ins><a class="tref internalDFN" title="list" href="#dfn-list"><ins class="diff-chg">
list
</ins></a><ins class="diff-chg">
is
an
ordered
sequence
</ins>
of
<del class="diff-old">the
Literal's
value.
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<ins class="diff-chg">IRIs
</ins></a>,<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node"><ins class="diff-chg">
blank
nodes
</ins></a>,<ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="json-ld_value" href="#dfn-json-ld_value"><ins class="diff-chg">
JSON-LD
values
</ins></a>.
</dd>
</dl>
</section>
<section id="algorithms">
<h2>
<span class="secno">
<del class="diff-old">4.
</del>
<ins class="diff-chg">5.
</ins>
</span>
Algorithms
</h2>
<p>
All
algorithms
described
in
this
section
are
intended
to
operate
on
language-native
data
structures.
That
is,
the
serialization
to
a
text-based
JSON
document
isn't
required
as
input
or
output
to
any
of
these
algorithms
and
language-native
data
structures
<em class="rfc2119" title="must">
must
</em>
be
used
where
applicable.
</p>
<section id="algorithm-terms">
<h3>
<span class="secno">
<del class="diff-old">4.1
</del>
<ins class="diff-chg">5.1
</ins>
</span>
Algorithm
Terms
</h3>
<dl>
<dt>
<dfn title="active_graph" id="dfn-active_graph">
<ins class="diff-new">active
graph
</ins></dfn></dt><dd><ins class="diff-new">
The
name
of
the
currently
active
graph
that
the
processor
should
use
when
processing.
</ins></dd><dt>
<dfn title="active_subject" id="dfn-active_subject">
active
subject
</dfn>
</dt>
<dd>
<del class="diff-old">the
</del>
<ins class="diff-chg">The
</ins>
currently
active
subject
that
the
processor
should
use
when
processing.
</dd>
<dt>
<dfn title="active_property" id="dfn-active_property">
active
property
</dfn>
</dt>
<dd>
<del class="diff-old">the
</del>
<ins class="diff-chg">The
</ins>
currently
active
property
that
the
processor
should
use
when
processing.
The
active
property
is
represented
in
the
original
lexical
form,
which
is
used
for
finding
<del class="diff-old">coercion
</del>
<ins class="diff-chg">type
</ins>
mappings
in
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
</dd>
<dt>
<dfn title="active_object" id="dfn-active_object">
active
object
</dfn>
</dt>
<dd>
<del class="diff-old">the
</del>
<ins class="diff-chg">The
</ins>
currently
active
object
that
the
processor
should
use
when
processing.
</dd>
<dt>
<dfn title="active_context" id="dfn-active_context">
active
context
</dfn>
</dt>
<dd>
<del class="diff-old">a
</del>
<ins class="diff-chg">A
</ins>
context
that
is
used
to
resolve
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
s
while
the
processing
algorithm
is
running.
The
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
is
the
context
contained
within
the
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>.
</dd>
<dt>
<del class="diff-old">compact
IRI
a
compact
IRI
is
has
the
form
of
prefix
and
suffix
and
is
used
as
a
way
of
expressing
an
IRI
without
needing
to
define
separate
term
definitions
for
each
IRI
contained
within
a
common
vocabulary
identified
by
prefix
.
</del>
<dfn title="local_context" id="dfn-local_context">
local
context
</dfn>
</dt>
<dd>
<del class="diff-old">a
</del>
<ins class="diff-chg">A
</ins>
context
that
is
specified
within
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>,
specified
via
the
<code>
@context
</code>
<a class="tref internalDFN" title="keyword" href="#dfn-keyword">
keyword
</a>.
</dd>
<dt>
<dfn title="processor_state" id="dfn-processor_state">
processor
state
</dfn>
</dt>
<dd>
<del class="diff-old">the
</del>
<ins class="diff-chg">The
</ins>
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>,
which
includes
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>,
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
and
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
The
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>
is
managed
as
a
stack
with
elements
from
the
previous
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>
copied
into
a
new
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>
when
entering
a
new
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>.
</dd>
<dt>
<dfn title="json-ld_input" id="dfn-json-ld_input">
JSON-LD
input
</dfn>
</dt>
<dd>
The
JSON-LD
data
structure
that
is
provided
as
input
to
the
algorithm.
</dd>
<dt>
<dfn title="json-ld_output" id="dfn-json-ld_output">
JSON-LD
output
</dfn>
</dt>
<dd>
The
JSON-LD
data
structure
that
is
produced
as
output
by
the
algorithm.
</dd>
<dt>
<dfn title="term" id="dfn-term">
term
</dfn>
</dt>
<dd>
A
<a class="tref internalDFN" title="term" href="#dfn-term">
term
</a>
is
a
short
word
defined
in
a
context
that
<em class="rfc2119" title="may">
may
</em>
be
expanded
to
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
</dd>
<dt>
<del class="diff-old">prefix
</del>
<dfn title="compact_iri" id="dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</dfn>
</dt>
<dd>
A
<del class="diff-old">prefix
is
a
term
that
expands
to
a
vocabulary
base
</del>
<ins class="diff-chg">compact
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">.
It
</del>
</abbr>
is
<del class="diff-old">typically
used
along
with
a
</del>
<ins class="diff-chg">has
the
form
of
</ins><dfn title="prefix" id="dfn-prefix"><ins class="diff-chg">
prefix
</ins></dfn>:
<em>
suffix
</em>
<del class="diff-old">to
form
</del>
<ins class="diff-chg">and
is
used
as
</ins>
a
<del class="diff-old">compact
</del>
<ins class="diff-chg">way
of
expressing
an
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-chg">without
needing
</ins>
to
<del class="diff-old">create
an
</del>
<ins class="diff-chg">define
separate
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
definitions
for
each
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-new">contained
</ins>
within
a
<del class="diff-old">vocabulary.
</del>
<ins class="diff-chg">common
vocabulary
identified
by
</ins><a class="tref internalDFN" title="prefix" href="#dfn-prefix"><ins class="diff-chg">
prefix
</ins></a>.
</dd>
<dt>
<del class="diff-old">language-tagged
string
</del>
<dfn title="node_object" id="dfn-node_object">
<ins class="diff-chg">node
object
</ins>
</dfn>
</dt>
<dd>
A
<del class="diff-old">language-tagged
string
</del>
<a class="tref internalDFN" title="node_object" href="#dfn-node_object">
<ins class="diff-chg">node
object
</ins>
</a>
<del class="diff-old">is
</del>
<ins class="diff-chg">represents
zero
or
more
properties
of
</ins>
a
<del class="diff-old">literal
</del>
<a class="tref internalDFN" title="node" href="#dfn-node">
<ins class="diff-chg">node
</ins>
</a>
<del class="diff-old">without
a
datatype,
including
</del>
<ins class="diff-chg">in
the
</ins><a class="tref internalDFN" title="json-ld_graph" href="#dfn-json-ld_graph"><ins class="diff-chg">
JSON-LD
graph
</ins></a><ins class="diff-chg">
serialized
by
the
JSON-LD
document.
A
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">language.
See
languaged-tagged
string
</del>
<a class="tref internalDFN" title="node_object" href="#dfn-node_object">
<ins class="diff-chg">node
object
</ins>
</a>
<del class="diff-old">in
[
RDF-CONCEPTS
</del>
<ins class="diff-chg">if
it
exists
outside
of
the
JSON-LD
</ins><a class="tref internalDFN" title="context" href="#dfn-context"><ins class="diff-chg">
context
</ins>
</a>
<del class="diff-old">].
</del>
<ins class="diff-chg">and:
</ins><ul><li><ins class="diff-chg">
it
does
not
contain
the
</ins><code><ins class="diff-chg">
@value
</ins></code>,<code><ins class="diff-chg">
@list
</ins></code>,<ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
keywords,
or
</ins></li><li><ins class="diff-chg">
it
is
not
the
top-level
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
in
the
JSON-LD
document
containing
the
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
keyword.
</ins></li></ul>
</dd>
<dt>
<del class="diff-old">typed
literal
</del>
<dfn title="list_object" id="dfn-list_object">
<ins class="diff-chg">list
object
</ins>
</dfn>
</dt>
<dd>
A
<del class="diff-old">typed
literal
</del>
<a class="tref internalDFN" title="list_object" href="#dfn-list_object">
<ins class="diff-chg">list
object
</ins>
</a>
is
a
<del class="diff-old">literal
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins>
</a>
<del class="diff-old">with
an
associated
</del>
<ins class="diff-chg">that
has
a
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
member.
</ins></dd><dt>
<del class="diff-old">IRI
</del>
<dfn title="scalar" id="dfn-scalar">
<ins class="diff-chg">scalar
</ins></dfn>
<del class="diff-old">which
indicates
the
literal's
datatype.
See
</del>
</dt>
<dd>
<ins class="diff-chg">A
scalar
is
either
a
JSON
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a>,<a class="tref internalDFN" title="number" href="#dfn-number"><ins class="diff-chg">
number
</ins></a>,<a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-chg">
true
</ins></a>,<ins class="diff-chg">
or
</ins><a class="tref internalDFN" title="false" href="#dfn-false"><ins class="diff-chg">
false
</ins></a>.</dd><dt>
<del class="diff-old">literal
</del>
<dfn title="quad" id="dfn-quad">
<ins class="diff-chg">quad
</ins></dfn>
<del class="diff-old">in
</del>
</dt>
<dd>
<ins class="diff-chg">An
</ins><em><ins class="diff-chg">
RDF
triple
</ins></em><ins class="diff-chg">
as
specified
by
</ins>
[
<cite>
<a class="bibref" href="#bib-RDF-CONCEPTS">
RDF-CONCEPTS
</a>
</cite>
<del class="diff-old">].
</del>
<ins class="diff-chg">]
augmented
with
a
a
fourth
component,
a
</ins><a class="tref internalDFN" title="graph_name" href="#dfn-graph_name"><ins class="diff-chg">
graph
name
</ins></a>.
</dd>
</dl>
</section>
<section id="expansion-algorithm">
<h3>
<span class="secno">
<del class="diff-old">4.2
</del>
<ins class="diff-chg">5.2
</ins>
</span>
<del class="diff-old">Context
Processing
</del>
<ins class="diff-chg">Expansion
Algorithm
</ins>
</h3>
<p>
<del class="diff-old">Processing
of
JSON-LD
data
structure
is
managed
recursively.
During
processing,
each
rule
is
applied
using
information
provided
by
the
</del>
<ins class="diff-chg">The
algorithm
takes
three
input
variables:
an
</ins>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
<del class="diff-old">.
Processing
begins
by
pushing
a
new
processor
state
onto
</del>
</a>,
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
and
an
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
to
be
expanded.
To
begin,
</ins>
the
<del class="diff-old">processor
state
stack.
If
a
local
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
</ins>
context
</a>
is
<del class="diff-old">encountered,
information
from
</del>
<ins class="diff-chg">set
to
</ins>
the
<del class="diff-old">local
context
</del>
<ins class="diff-chg">result
of
performing,
</ins><a href="#context-processing"><ins class="diff-chg">
Context
Processing
</ins>
</a>
<del class="diff-old">is
merged
into
</del>
<ins class="diff-chg">on
</ins>
the
<del class="diff-old">active
context
.
The
active
context
</del>
<ins class="diff-chg">passed
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code>,<ins class="diff-chg">
or
empty
if
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins>
</a>
</code>
is
<del class="diff-old">used
for
expanding
properties
and
values
of
a
JSON
object
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,<a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins>
</a>
<del class="diff-old">(or
elements
of
an
array)
using
a
term
mapping
.
It
</del>
is
<del class="diff-old">also
used
to
maintain
coercion
mapping
s
from
terms
to
datatypes,
language
mapping
s
from
terms
</del>
<ins class="diff-chg">set
</ins>
to
<del class="diff-old">language
codes,
and
list
mapping
s
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,
and
<del class="diff-old">set
mapping
s
for
terms.
Processors
must
</del>
<em>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">use
</del>
<ins class="diff-chg">is
set
to
</ins>
the
<del class="diff-old">lexical
form
of
</del>
<a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input">
<ins class="diff-chg">JSON-LD
input
</ins></a>.<ins class="diff-chg">
This
algorithm
expects
</ins>
the
<del class="diff-old">property
when
creating
</del>
<a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input">
<ins class="diff-chg">JSON-LD
input
</ins></a><ins class="diff-chg">
to
be
</ins>
a
<del class="diff-old">mapping,
</del>
<ins class="diff-chg">well-formed
JSON-LD
document
</ins>
as
<del class="diff-old">lookup
is
performed
on
lexical
forms,
not
expanded
IRI
representations.
A
local
context
</del>
<ins class="diff-chg">defined
in
[
</ins><cite><a class="bibref" href="#bib-JSON-LD"><ins class="diff-chg">
JSON-LD
</ins>
</a>
</cite>
<ins class="diff-new">].
</ins></p><ol class="algorithm"><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
element
</ins></em>
is
<del class="diff-old">identified
within
</del>
a
<del class="diff-old">JSON
object
</del>
<a class="tref internalDFN" title="scalar" href="#dfn-scalar">
<ins class="diff-chg">scalar
</ins></a>,<ins class="diff-chg">
expand
it
according
to
the
</ins><a href="#value-expansion"><ins class="diff-chg">
Value
Expansion
</ins>
</a>
<del class="diff-old">having
a
@context
</del>
<ins class="diff-chg">algorithm,
passing
copies
of
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
</ins>
property
<del class="diff-old">with
a
string
</del>
</a>
<ins class="diff-chg">and
return.
</ins></li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins>
</a>,
<ins class="diff-new">return.
</ins></li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
element
</ins></em><ins class="diff-new">
is
an
</ins>
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">or
a
JSON
object
value.
When
processing
a
local
context
</del>
</a>,
<del class="diff-old">special
processing
rules
apply:
</del>
<ol class="algorithm">
<li>
<del class="diff-old">Create
a
new,
</del>
<ins class="diff-chg">initialize
an
</ins>
empty
<del class="diff-old">local
context
.
</del>
<ins class="diff-chg">array
</ins><em><ins class="diff-chg">
result
</ins></em>.
</li>
<li>
<del class="diff-old">Let
</del>
<ins class="diff-chg">Expand
each
</ins>
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">item
</ins>
</em>
<del class="diff-old">be
the
value
</del>
<ins class="diff-chg">by
recursively
using
this
algorithm,
passing
copies
</ins>
of
<del class="diff-old">@context
If
context
equals
null
,
clear
</del>
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<ins class="diff-new">and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins>
</a>.
</li>
<li>
If
<ins class="diff-new">the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property's
</ins></a><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-new">
container
mapping
</ins></a><ins class="diff-new">
is
set
to
</ins><code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
and
the
expanded
</ins>
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">item
</ins>
</em>
is
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">,
process
each
element
as
</del>
</a>
<ins class="diff-chg">or
a
</ins><a class="tref internalDFN" title="list_object" href="#dfn-list_object"><ins class="diff-chg">
list
object
</ins></a><ins class="diff-chg">
trigger
a
</ins><code class="error"><ins class="diff-chg">
LIST_OF_LISTS_DETECTED
</ins></code><ins class="diff-chg">
error.
</ins></li><li><ins class="diff-chg">
If
the
expanded
</ins>
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">item
</ins>
</em>
<del class="diff-old">in
order
by
starting
at
Step
2.1
.
</del>
<ins class="diff-chg">is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
drop
it.
</ins>
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise,
if
the
expanded
</ins>
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">item
</ins>
</em>
is
<del class="diff-old">a
string
</del>
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins>
</a>,
<del class="diff-old">it
must
</del>
<ins class="diff-chg">merge
its
entries
with
</ins><em><ins class="diff-chg">
result's
</ins>
</em>
<del class="diff-old">have
a
lexical
form
of
IRI
.
</del>
<ins class="diff-chg">entries.
</ins></li>
<li>
<del class="diff-old">Expand
</del>
<ins class="diff-chg">Otherwise,
append
</ins>
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">item
</ins>
</em>
<del class="diff-old">according
</del>
to
<del class="diff-old">IRI
Expansion
.
Dereference
</del>
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">result
</ins>
</em>.
</li>
<li>
<del class="diff-old">If
the
resulting
document
is
a
JSON
document,
extract
the
top-level
@context
element
using
the
JSON
Pointer
&quot;/@context&quot;
as
described
in
[
JSON-POINTER
].
Set
</del>
<ins class="diff-chg">Finally,
set
</ins>
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">element
</ins>
</em>
to
<del class="diff-old">the
extracted
content
</del>
<em>
<ins class="diff-chg">result
</ins></em>
and
<del class="diff-old">process
it
by
starting
at
Step
2.1
.
</del>
<ins class="diff-chg">return.
</ins>
</li>
</ol>
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise,
</ins>
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">is
a
JSON
object
,
perform
the
following
steps:
</del>
<ins class="diff-chg">must
be
an
object.
</ins>
<ol class="algorithm">
<li>
If
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">element
</ins>
</em>
has
a
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@context
</ins>
</code>
<del class="diff-old">property,
it
must
have
a
value
of
a
simple
string
</del>
<ins class="diff-chg">member,
update
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins>
</a>
<del class="diff-old">with
</del>
<ins class="diff-chg">according
to
</ins>
the
<del class="diff-old">lexical
form
described
</del>
<ins class="diff-chg">steps
outlined
</ins>
in
<del class="diff-old">[
BCP47
</del>
<a href="#context-processing">
<ins class="diff-chg">Context
Processing
</ins>
</a>
<del class="diff-old">],
or
null
.
Add
the
language
to
</del>
<ins class="diff-chg">and
remove
</ins>
the
<del class="diff-old">local
context
.
</del>
<code>
<ins class="diff-chg">@context
</ins></code><ins class="diff-chg">
member.
</ins>
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Initialize
an
empty
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>
<em>
<del class="diff-old">value
has
a
@vocab
key,
it
must
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">have
a
value
of
a
simple
string
with
the
lexical
form
of
an
absolute
IRI
,
or
null
.
Add
the
vocabulary
mapping
to
the
local
context
.
</del>
<ins class="diff-chg">and
</ins>
</li>
<del class="diff-old">Otherwise,
for
</del>
<li>
<ins class="diff-chg">then
process
</ins>
each
<em>
property
</em>
<ins class="diff-new">and
</ins><em><ins class="diff-new">
value
</ins></em>
in
<em>
<del class="diff-old">context
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">perform
the
following
steps:
</del>
<ins class="diff-chg">ordered
by
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
as
follows:
</ins>
<ol class="algorithm">
<li>
If
the
<del class="diff-old">property's
value
is
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
context
</ins></a><ins class="diff-chg">
contains
</ins>
a
<del class="diff-old">simple
string
</del>
<a class="tref internalDFN" title="property_generator" href="#dfn-property_generator">
<ins class="diff-chg">property
generator
</ins></a><ins class="diff-chg">
for
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
set
</ins><em><ins class="diff-chg">
expanded
property
</ins></em><ins class="diff-chg">
to
its
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><ins class="diff-chg">
IRIs
</ins>
</a>,
<del class="diff-old">determine
</del>
<ins class="diff-chg">otherwise
set
it
to
</ins>
the
<del class="diff-old">IRI
mapping
value
by
performing
</del>
<ins class="diff-chg">result
of
expanding
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
according
to
the
steps
outlined
in
</ins>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
<del class="diff-old">on
</del>
<ins class="diff-chg">(passing
</ins><code><ins class="diff-chg">
true
</ins></code><ins class="diff-chg">
for
</ins>
the
<del class="diff-old">associated
value.
</del>
<em>
<ins class="diff-chg">vocabRelative
</ins></em><ins class="diff-chg">
flag).
</ins></li><li>
If
<del class="diff-old">the
result
of
the
IRI
mapping
is
an
absolute
IRI
,
merge
the
property
into
the
local
context
term
mapping
,
unless
the
</del>
<em>
<ins class="diff-chg">expanded
</ins>
property
</em>
is
<del class="diff-old">a
JSON-LD
keyword
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins>
</a>,
<del class="diff-old">in
which
case
return
an
error.
Otherwise,
if
</del>
<ins class="diff-chg">skip
</ins>
the
<del class="diff-old">property's
</del>
<ins class="diff-chg">current
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
-
</ins><em>
value
<del class="diff-old">is
null
remove
mapping,
coercion,
container
</del>
</em>
<ins class="diff-chg">pair
</ins>
and
<del class="diff-old">language
information
associated
with
property
from
the
local
context
.
Otherwise,
</del>
<ins class="diff-chg">continue
to
</ins>
the
<ins class="diff-new">next
</ins>
<em>
property
</em>
<del class="diff-old">'s
</del>
<ins class="diff-chg">-
</ins>
<em>
value
</em>
<del class="diff-old">must
be
a
JSON
object
.
</del>
<ins class="diff-chg">pair
in
</ins><em><ins class="diff-chg">
element
</ins></em>.</li>
<li>
If
<del class="diff-old">the
</del>
<em>
<ins class="diff-new">expanded
</ins>
property
</em>
is
a
<del class="diff-old">JSON-LD
</del>
<a class="tref internalDFN" title="keyword" href="#dfn-keyword">
keyword
<del class="diff-old">and
the
value
has
</del>
</a>,
<ins class="diff-chg">process
it
as
follows:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
expanded
property
</ins></em><ins class="diff-chg">
equals
</ins>
<code>
@id
</code>,
<ins class="diff-new">set
the
</ins>
<code>
<del class="diff-old">@language
or
@type
</del>
<ins class="diff-chg">@id
</ins>
</code>
<del class="diff-old">properties,
return
an
error.
Issue
</del>
<ins class="diff-chg">member
of
</ins><em><ins class="diff-chg">
result
</ins></em><ins class="diff-chg">
to
the
result
of
expanding
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
according
the
</ins><a href="#iri-expansion">
<del class="diff-old">Undecided
if
@type
or
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a><ins class="diff-chg">
(passing
</ins>
<code>
<del class="diff-old">@graph
</del>
<ins class="diff-chg">true
</ins>
</code>
<del class="diff-old">can
take
</del>
<ins class="diff-chg">for
the
</ins><em><ins class="diff-chg">
documentRelative
</ins></em><ins class="diff-chg">
flag).
If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
not
</ins>
a
<del class="diff-old">@container
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
<ins class="diff-chg">string
</ins></a><ins class="diff-chg">
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_ID_VALUE
</ins>
</code>
<del class="diff-old">with
@set
.
</del>
<ins class="diff-chg">error.
</ins>
</li>
<li>
If
<del class="diff-old">the
</del>
<em>
<ins class="diff-new">expanded
</ins>
property
</em>
<del class="diff-old">has
</del>
<ins class="diff-chg">equals
</ins><code><ins class="diff-chg">
@type
</ins></code>,<ins class="diff-chg">
set
</ins>
the
<del class="diff-old">form
of
term
,
its
value
must
have
an
</del>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">property
with
a
string
value
which
must
</del>
<ins class="diff-chg">member
of
</ins><em><ins class="diff-chg">
result
</ins>
</em>
<del class="diff-old">have
</del>
<ins class="diff-chg">to
</ins>
the
<del class="diff-old">form
</del>
<ins class="diff-chg">result
</ins>
of
<del class="diff-old">a
term
,
compact
IRI
,
or
absolute
IRI
.
Determine
</del>
<ins class="diff-chg">expanding
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
according
</ins>
the
<del class="diff-old">IRI
mapping
by
performing
</del>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
<ins class="diff-new">algorithm
</ins>
</a>
<del class="diff-old">on
the
associated
value.
If
</del>
<ins class="diff-chg">(passing
</ins><code><ins class="diff-chg">
true
</ins></code><ins class="diff-chg">
for
both
</ins>
the
<del class="diff-old">result
of
</del>
<em>
<ins class="diff-chg">documentRelative
</ins></em><ins class="diff-chg">
and
</ins>
the
<del class="diff-old">IRI
mapping
</del>
<em>
<ins class="diff-chg">vocabRelative
</ins></em><ins class="diff-chg">
flag).
If
</ins><em><ins class="diff-chg">
value
</ins></em>
is
<ins class="diff-new">neither
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-new">
string
</ins></a><ins class="diff-new">
nor
</ins>
an
<del class="diff-old">absolute
IRI
,
merge
the
</del>
<a class="tref internalDFN" title="array" href="#dfn-array">
<ins class="diff-chg">array
</ins></a><ins class="diff-chg">
of
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
strings
</ins></a><ins class="diff-chg">
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_TYPE_VALUE
</ins></code><ins class="diff-chg">
error.
Empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
arrays
</ins></a><ins class="diff-chg">
are
ignored.
</ins></li><li><ins class="diff-chg">
If
</ins>
<em>
<ins class="diff-new">expanded
</ins>
property
</em>
<del class="diff-old">into
</del>
<ins class="diff-chg">equals
</ins><code><ins class="diff-chg">
@value
</ins></code>,<ins class="diff-chg">
set
</ins>
the
<del class="diff-old">local
context
</del>
<code>
<ins class="diff-chg">@value
</ins></code><ins class="diff-chg">
member
of
</ins><em><ins class="diff-chg">
result
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
value
</ins></em>.<ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
neither
a
</ins><a class="tref internalDFN" title="scalar" href="#dfn-scalar"><ins class="diff-chg">
scalar
</ins>
</a>
<del class="diff-old">term
mapping
.
</del>
<ins class="diff-chg">nor
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_VALUE_OBJECT_VALUE
</ins></code><ins class="diff-chg">
error.
</ins>
</li>
<li>
If
<del class="diff-old">the
</del>
<em>
<ins class="diff-new">expanded
</ins>
property
</em>
<del class="diff-old">has
</del>
<ins class="diff-chg">equals
</ins><code><ins class="diff-chg">
@language
</ins></code>,<ins class="diff-chg">
set
</ins>
the
<del class="diff-old">form
of
</del>
<code>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
member
</ins>
of
<del class="diff-old">a
compact
IRI
or
absolute
IRI
,
</del>
<em>
<ins class="diff-chg">result
</ins></em><ins class="diff-chg">
to
</ins>
the
<ins class="diff-new">lowercased
</ins><em><ins class="diff-new">
value
</ins></em>.<ins class="diff-new">
If
</ins>
<em>
value
</em>
<del class="diff-old">may
have
</del>
<ins class="diff-chg">is
not
</ins>
a
<del class="diff-old">@id
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
<ins class="diff-chg">string
</ins></a>,<ins class="diff-chg">
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_LANGUAGE_VALUE
</ins>
</code>
<ins class="diff-new">error.
</ins></li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
expanded
</ins>
property
<del class="diff-old">with
a
string
value
which
must
</del>
</em>
<del class="diff-old">have
</del>
<ins class="diff-chg">equals
</ins><code><ins class="diff-chg">
@annotation
</ins></code>,<ins class="diff-chg">
set
</ins>
the
<del class="diff-old">form
</del>
<code>
<ins class="diff-chg">@annotation
</ins></code><ins class="diff-chg">
member
</ins>
of
<em>
<ins class="diff-new">result
</ins></em><ins class="diff-new">
to
</ins><em><ins class="diff-new">
value
</ins></em>.<ins class="diff-new">
If
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
is
not
</ins>
a
<del class="diff-old">term
,
compact
IRI
,
or
absolute
IRI
.
Determine
the
IRI
mapping
by
performing
IRI
Expansion
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
<ins class="diff-chg">string
</ins>
</a>
<del class="diff-old">on
the
associated
value.
</del>
<ins class="diff-chg">trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_ANNOTATION_VALUE
</ins></code><ins class="diff-chg">
error.
</ins></li><li>
If
<em>
<ins class="diff-new">expanded
property
</ins></em><ins class="diff-new">
equals
</ins><code><ins class="diff-new">
@set
</ins></code><ins class="diff-new">
or
</ins><code><ins class="diff-new">
@list
</ins></code>,<ins class="diff-new">
set
</ins>
the
<del class="diff-old">result
</del>
<em>
<ins class="diff-chg">expanded
property
</ins></em><ins class="diff-chg">
member
</ins>
of
<em>
<ins class="diff-new">result
</ins></em><ins class="diff-new">
to
</ins>
the
<del class="diff-old">IRI
mapping
is
an
absolute
IRI
,
merge
the
</del>
<ins class="diff-chg">result
of
expanding
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">into
</del>
<ins class="diff-chg">by
recursively
using
this
algorithm,
passing
copies
of
</ins>
the
<del class="diff-old">local
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
</ins>
context
</a>
<del class="diff-old">term
mapping
</del>
<ins class="diff-chg">and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins>
</a>.
</li>
<li>
If
<del class="diff-old">the
</del>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">expanded
property
</ins>
</em>
<del class="diff-old">has
a
</del>
<ins class="diff-chg">equals
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@graph
</ins></code>,<ins class="diff-chg">
set
the
</ins><code><ins class="diff-chg">
@graph
</ins>
</code>
<del class="diff-old">property,
its
value
must
</del>
<ins class="diff-chg">member
of
</ins><em><ins class="diff-chg">
result
</ins>
</em>
<del class="diff-old">have
</del>
<ins class="diff-chg">to
</ins>
the
<del class="diff-old">form
</del>
<ins class="diff-chg">result
of
expanding
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
by
recursively
using
this
algorithm,
passing
copies
</ins>
of
<del class="diff-old">a
term
,
compact
IRI
,
absolute
IRI
,
or
</del>
the
<del class="diff-old">keyword
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
context
</ins>
</a>
<ins class="diff-new">and
</ins>
<code>
<del class="diff-old">@id
.
Determine
the
IRI
by
performing
IRI
Expansion
on
</del>
<ins class="diff-chg">@graph
</ins></code><ins class="diff-chg">
as
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>.</li><li><ins class="diff-chg">
Continue
with
</ins>
the
<del class="diff-old">associated
value.
</del>
<ins class="diff-chg">next
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
pair
from
</ins><em><ins class="diff-chg">
element
</ins></em>.</li></ol></li><li>
If
<del class="diff-old">the
result
of
the
IRI
mapping
</del>
<em>
<ins class="diff-chg">expanded
property
</ins></em>
is
<ins class="diff-new">not
</ins>
an
<a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">or
@id
,
merge
into
the
local
context
coercion
mapping
using
the
lexical
value
of
</del>
</a>,i.e.,
<ins class="diff-chg">it
doesn't
contain
a
colon,
continue
with
</ins>
the
<ins class="diff-new">next
member
from
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">element
</ins>
</em>.
</li>
<li>
<del class="diff-old">If
the
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
<em>
<del class="diff-old">value
has
a
@container
property,
its
value
must
</del>
<ins class="diff-chg">property's
</ins>
</em>
<del class="diff-old">be
@list
or
@set
.
Merge
the
list
</del>
<a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping">
<ins class="diff-chg">container
</ins>
mapping
</a>
<del class="diff-old">or
</del>
<ins class="diff-chg">is
</ins>
set
<del class="diff-old">mapping
into
the
local
context
</del>
<ins class="diff-chg">to
</ins><code><ins class="diff-chg">
@language
</ins></code><ol class="algorithm"><li><ins class="diff-chg">
Initialize
a
new
empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">using
the
lexical
value
of
the
</del>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">language
map
values
</ins>
</em>.
</li>
<li>
<del class="diff-old">If
the
</del>
<ins class="diff-chg">Process
each
</ins><em><ins class="diff-chg">
key
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
val
</ins></em><ins class="diff-chg">
pair
of
</ins>
<em>
value
</em>
<del class="diff-old">has
</del>
<ins class="diff-chg">ordered
by
</ins><em><ins class="diff-chg">
key
</ins></em><ins class="diff-chg">
as
follows:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
val
</ins></em><ins class="diff-chg">
is
not
an
array,
transform
it
to
one.
</ins></li><li><ins class="diff-chg">
For
each
item
of
</ins><em><ins class="diff-chg">
val
</ins></em>,<ins class="diff-chg">
construct
</ins>
a
<ins class="diff-new">new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
consisting
of
two
members:
</ins>
<code>
<del class="diff-old">@language
property
but
no
@type
</del>
<ins class="diff-chg">@value
</ins>
</code>
<del class="diff-old">property,
the
value
of
</del>
<ins class="diff-chg">set
to
</ins>
the
<ins class="diff-new">currently
processed
item
and
</ins>
<code>
@language
</code>
<del class="diff-old">property
must
</del>
<ins class="diff-chg">set
to
the
lowercased
</ins><em><ins class="diff-chg">
key
</ins></em>.<ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
val
</ins>
</em>
<del class="diff-old">be
</del>
<ins class="diff-chg">is
not
</ins>
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
<del class="diff-old">or
null
.
Merge
</del>
</a>,
<ins class="diff-chg">trigger
a
</ins><code class="error"><ins class="diff-chg">
LANGUAGE_MAP_INVALID_VALUE
</ins></code><ins class="diff-chg">
error.
Otherwise
append
</ins>
the
<ins class="diff-chg">object
to
</ins><em>
language
<del class="diff-old">mapping
into
the
local
context
using
the
lexical
</del>
<ins class="diff-chg">map
values
</ins></em>.</li></ol></li><li><ins class="diff-chg">
Set
</ins><em>
value
<del class="diff-old">of
the
</del>
</em>
<ins class="diff-chg">to
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">language
map
values
</ins>
</em>.
</li>
</ol>
</li>
<li>
<del class="diff-old">Merge
the
local
context
</del>
<ins class="diff-chg">Otherwise,
if
</ins><em><ins class="diff-chg">
property's
</ins></em><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
mapping
</ins>
</a>
<del class="diff-old">into
</del>
<ins class="diff-chg">is
set
to
</ins><code><ins class="diff-chg">
@annotation
</ins></code><ol class="algorithm"><li><ins class="diff-chg">
Initialize
a
new
empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><em><ins class="diff-chg">
annotation
map
values
</ins></em>.</li><li><ins class="diff-chg">
Process
each
</ins><em><ins class="diff-chg">
key
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
val
</ins></em><ins class="diff-chg">
pair
of
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
ordered
by
</ins><em><ins class="diff-chg">
key
</ins></em><ins class="diff-chg">
as
follows:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
val
</ins></em><ins class="diff-chg">
is
not
an
array,
transform
it
to
one.
</ins></li><li><ins class="diff-chg">
Expand
</ins><em><ins class="diff-chg">
val
</ins></em><ins class="diff-chg">
by
recursively
using
this
algorithm,
passing
copies
of
</ins>
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<ins class="diff-new">and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins>
</a>.
</li>
<li>
<del class="diff-old">Repeat
Step
2.4.2
until
no
entries
are
added
</del>
<ins class="diff-chg">Add
to
each
item
of
</ins><em><ins class="diff-chg">
val
</ins></em><ins class="diff-chg">
a
member
</ins><code><ins class="diff-chg">
@annotation
</ins></code><ins class="diff-chg">
set
</ins>
to
<em>
<ins class="diff-new">key
</ins></em><ins class="diff-new">
if
no
such
member
exists
yet
and
append
</ins>
the
<del class="diff-old">local
context
.
</del>
<ins class="diff-chg">resulting
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
annotation
map
values
</ins></em>.
</li>
</ol>
</li>
<li>
<ins class="diff-chg">Set
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
annotation
map
values
</ins></em>.
</li>
</ol>
</li>
<del class="diff-old">Note
It
can
be
difficult
to
distinguish
between
a
compact
IRI
</del>
<li>
<ins class="diff-chg">Otherwise,
expand
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
by
recursively
using
this
algorithm,
passing
copies
of
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins>
</a>
and
<del class="diff-old">an
absolute
IRI
,
</del>
<em>
<ins class="diff-chg">property
</ins></em>
as
<del class="diff-old">a
compact
IRI
may
seem
to
be
a
valid
IRI
</del>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-chg">active
property
</ins></a>.</li><li><ins class="diff-chg">
If
the
expanded
</ins>
<em>
<del class="diff-old">scheme
</del>
<ins class="diff-chg">value
</ins></em><ins class="diff-chg">
equals
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
continue
with
the
next
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
pair
from
</ins><em><ins class="diff-chg">
element
</ins>
</em>.
<del class="diff-old">When
performing
repeated
IRI
expansion,
a
term
used
as
a
prefix
may
not
have
a
valid
</del>
</li>
<li>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
property's
</ins></em><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
</ins>
mapping
<del class="diff-old">due
to
dependencies
in
resolving
term
definitions.
By
continuing
Step
2.3.2
</del>
</a>
<del class="diff-old">until
no
changes
are
made,
mappings
to
IRIs
created
using
an
undefined
term
prefix
will
eventually
expand
</del>
<ins class="diff-chg">is
set
</ins>
to
<del class="diff-old">an
absolute
IRI
s.
4.3
IRI
Expansion
Keys
</del>
<code>
<ins class="diff-chg">@list
</ins></code>
and
<del class="diff-old">some
values
are
evaluated
to
produce
an
IRI
.
This
section
defines
an
algorithm
for
transforming
a
</del>
<em>
value
<del class="diff-old">representing
an
IRI
into
</del>
</em>
<ins class="diff-chg">is
either
not
</ins>
an
<del class="diff-old">actual
IRI
.
IRIs
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins>
</a>
<del class="diff-old">may
be
represented
as
an
absolute
IRI
,
a
term
,
a
compact
IRI
,
</del>
or
<del class="diff-old">as
</del>
a
<del class="diff-old">value
relative
to
@vocab
.
An
absolute
IRI
is
defined
in
[
RFC3987
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins>
</a>
<del class="diff-old">]
containing
a
</del>
<ins class="diff-chg">without
an
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
member,
replace
</ins>
<em>
<del class="diff-old">scheme
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">along
</del>
with
<ins class="diff-new">a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
with
an
</ins><code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
member
whose
value
is
set
to
</ins>
<em>
<del class="diff-old">path
and
optional
query
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">and
fragment
segments.
A
relative
IRI
is
</del>
<ins class="diff-chg">(wrapped
in
</ins>
an
<del class="diff-old">IRI
that
is
relative
some
other
absolute
IRI
</del>
<a class="tref internalDFN" title="array" href="#dfn-array">
<ins class="diff-chg">array
</ins>
</a>
<del class="diff-old">;
in
the
case
of
JSON-LD
this
</del>
<ins class="diff-chg">if
it
is
not
already
one).
</ins></li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
expanded
property
</ins></em>
is
<del class="diff-old">the
base
location
of
the
document.
The
algorithm
for
generating
</del>
an
<del class="diff-old">IRI
is:
</del>
<a class="tref internalDFN" title="array" href="#dfn-array">
<ins class="diff-chg">array
</ins></a>,
<ol class="algorithm">
<li>
<del class="diff-old">If
the
active
context
contains
a
term
</del>
<ins class="diff-chg">label
all
</ins><a class="tref internalDFN" title="blank_node" href="#dfn-blank_node"><ins class="diff-chg">
blank
nodes
</ins>
</a>
<del class="diff-old">mapping
for
the
</del>
<ins class="diff-chg">in
</ins><em>
value
</em>
<ins class="diff-new">with
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-new">
blank
node
identifiers
</ins></a><ins class="diff-new">
by
</ins>
using
<del class="diff-old">a
case-sensitive
comparison,
use
</del>
the
<del class="diff-old">mapped
</del>
<a href="#label-blank-nodes-algorithm">
<ins class="diff-chg">Label
Blank
Nodes
Algorithm
</ins></a>.</li><li><ins class="diff-chg">
Then,
for
each
</ins><em><ins class="diff-chg">
iri
</ins></em><ins class="diff-chg">
of
</ins><em><ins class="diff-chg">
expanded
property
</ins></em><ins class="diff-chg">
merge
a
copy
of
</ins><em>
value
<del class="diff-old">as
an
IRI
.
</del>
</em>
<ins class="diff-chg">into
the
</ins><em><ins class="diff-chg">
iri
</ins></em><ins class="diff-chg">
member
of
the
</ins><em><ins class="diff-chg">
result
</ins></em><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>.</li></ol>
</li>
<li>
Otherwise,
<del class="diff-old">split
the
</del>
<ins class="diff-chg">merge
</ins><em>
value
</em>
into
<del class="diff-old">a
</del>
<ins class="diff-chg">the
</ins>
<em>
<del class="diff-old">prefix
</del>
<ins class="diff-chg">iri
</ins></em><ins class="diff-chg">
member
of
the
</ins><em><ins class="diff-chg">
result
</ins></em><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>.</li></ol></li><li><ins class="diff-chg">
Set
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
result
</ins>
</em>
and
<em>
<del class="diff-old">suffix
</del>
<ins class="diff-chg">numProperties
</ins>
</em>
<del class="diff-old">from
</del>
<ins class="diff-chg">to
</ins>
the
<del class="diff-old">first
occurrence
</del>
<ins class="diff-chg">number
</ins>
of
<del class="diff-old">':'.
</del>
<ins class="diff-chg">members
of
</ins><em><ins class="diff-chg">
result
</ins></em>.
</li>
<li>
If
<del class="diff-old">the
prefix
is
a
'_'
(underscore),
the
value
represents
a
named
blank
node
.
</del>
<em>
<ins class="diff-chg">element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@annotation
</ins></code><ins class="diff-chg">
member,
decrease
</ins><em><ins class="diff-chg">
numProperties
</ins></em><ins class="diff-chg">
by
1.
</ins>
</li>
<li>
If
<del class="diff-old">the
active
context
contains
a
term
mapping
for
</del>
<em>
<del class="diff-old">prefix
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">using
a
case-sensitive
comparison,
and
</del>
<ins class="diff-chg">has
an
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member,
</ins><ol class="algorithm"><li><ins class="diff-chg">
decrease
</ins>
<em>
<del class="diff-old">suffix
</del>
<ins class="diff-chg">numProperties
</ins>
</em>
<del class="diff-old">does
not
does
not
begin
with
'//'
(i.e.,
it
does
not
match
a
</del>
<ins class="diff-chg">by
1.
</ins></li><li><ins class="diff-chg">
If
</ins>
<em>
<del class="diff-old">hier-part
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">including
</del>
<ins class="diff-chg">has
an
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
member,
decrease
</ins>
<em>
<del class="diff-old">authority
</del>
<ins class="diff-chg">numProperties
</ins>
</em>
<del class="diff-old">(as
defined
in
[
RFC3986
]),
generate
an
IRI
</del>
by
<del class="diff-old">prepending
the
mapped
prefix
to
the
(possibly
empty)
suffix
using
textual
concatenation.
Note
that
an
empty
suffix
</del>
<ins class="diff-chg">1
</ins>
and
<del class="diff-old">no
suffix
(meaning
</del>
<ins class="diff-chg">check
that
</ins>
the
value
<del class="diff-old">contains
no
':'
string
at
all)
are
treated
equivalently.
</del>
<ins class="diff-chg">of
the
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member
is
a
string.
If
not,
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_LANGUAGE_TAGGED_STRING
</ins></code><ins class="diff-chg">
error.
</ins>
</li>
<li>
Otherwise,
if
<del class="diff-old">the
IRI
being
processed
does
not
contain
a
colon
</del>
<em>
<ins class="diff-chg">element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member,
decrease
</ins><em><ins class="diff-chg">
numProperties
</ins></em><ins class="diff-chg">
by
1
</ins>
and
<del class="diff-old">is
a
property,
i.e.,
a
key
in
a
JSON
object
,
or
</del>
<ins class="diff-chg">check
that
</ins>
the
value
of
<ins class="diff-new">the
</ins>
<code>
@type
</code>
<del class="diff-old">and
the
active
context
has
</del>
<ins class="diff-chg">member
is
</ins>
a
<del class="diff-old">@vocab
</del>
<ins class="diff-chg">string.
If
not,
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_TYPED_VALUE
</ins>
</code>
<del class="diff-old">mapping,
join
</del>
<ins class="diff-chg">error.
</ins></li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
numProperties
</ins></em><ins class="diff-chg">
is
greater
than
0,
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_VALUE_OBJECT
</ins></code><ins class="diff-chg">
error.
</ins></li><li><ins class="diff-chg">
If
</ins>
the
<del class="diff-old">mapped
</del>
value
<del class="diff-old">to
</del>
<ins class="diff-chg">of
</ins>
the
<del class="diff-old">suffix
using
textual
concatenation.
</del>
<code>
<ins class="diff-chg">@value
</ins></code><ins class="diff-chg">
member
equals
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
to
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
if
the
IRI
being
processed
does
not
contain
a
colon
and
</del>
<ins class="diff-chg">Return.
</ins></li></ol></li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
whose
value
</ins>
is
not
<del class="diff-old">a
property,
i.e.,
not
a
key
in
a
JSON
object
treat
</del>
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
transform
</ins>
it
<del class="diff-old">as
a
relative
IRI
</del>
<ins class="diff-chg">to
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
member
</ins>
and
<del class="diff-old">resolve
it
against
the
base
IRI
as
per
[
RFC3986
]
using
only
the
basic
algorithm
in
section
5.2.
Neither
</del>
<em>
<del class="diff-old">Syntax-Based
Normalization
</del>
<ins class="diff-chg">numProperties
</ins>
</em>
<del class="diff-old">nor
</del>
<ins class="diff-chg">is
greater
than
1,
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_SET_OR_LIST_OBJECT
</ins></code><ins class="diff-chg">
error.
</ins></li><li><ins class="diff-chg">
Otherwise,
if
</ins>
<em>
<del class="diff-old">Scheme-Based
Normalization
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">(described
in
sections
6.2.2
and
6.2.3
of
[
RFC3986
])
are
performed.
Characters
additionally
allowed
in
IRI
references
are
treated
in
</del>
<ins class="diff-chg">has
an
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
member,
set
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">same
way
that
unreserved
characters
are
treated
in
URI
references,
per
section
6.5
</del>
<ins class="diff-chg">value
</ins>
of
<del class="diff-old">[
RFC3987
].
</del>
<ins class="diff-chg">that
member.
</ins>
</li>
<li>
Otherwise,
<del class="diff-old">use
the
value
directly
as
</del>
<ins class="diff-chg">if
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
just
</ins>
an
<del class="diff-old">IRI
.
</del>
<code>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
member,
set
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
to
null.
</ins></li></ol>
</li>
</ol>
<p>
<ins class="diff-chg">If,
after
the
algorithm
outlined
above
is
run,
the
resulting
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
is
an
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
with
just
a
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
member,
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
is
set
to
the
value
of
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
's
value.
Finally,
if
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>,<ins class="diff-chg">
it
is
wrapped
into
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.
</p>
</section>
<section typeof="bibo:Chapter" resource="#context" rel="bibo:chapter" id="context-processing">
<h3 id="context">
<span class="secno">
<del class="diff-old">4.4
</del>
<ins class="diff-chg">5.3
</ins>
</span>
<del class="diff-old">IRI
Compaction
</del>
<ins class="diff-chg">Context
Processing
</ins>
</h3>
<p>
<del class="diff-old">Some
keys
</del>
<ins class="diff-chg">Processing
of
JSON-LD
data
structure
is
managed
recursively.
During
processing,
each
rule
is
applied
using
information
provided
by
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>.</p><p><ins class="diff-chg">
The
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
contains
the
active
</ins><dfn title="term_definition" id="dfn-term_definition"><ins class="diff-chg">
term
definitions
</ins></dfn><ins class="diff-chg">
which
specify
how
properties
</ins>
and
values
<del class="diff-old">are
expressed
using
IRI
</del>
<ins class="diff-chg">have
to
be
interpreted
as
well
as
the
current
</ins><dfn title="vocabulary_mapping" id="dfn-vocabulary_mapping"><ins class="diff-chg">
vocabulary
mapping
</ins></dfn><ins class="diff-chg">
and
the
</ins><dfn title="default_language" id="dfn-default_language"><ins class="diff-chg">
default
language
</ins></dfn>.<ins class="diff-chg">
Each
</ins><a class="tref internalDFN" title="term_definition" href="#dfn-term_definition"><ins class="diff-chg">
term
definition
</ins>
</a>
<del class="diff-old">s.
This
section
defines
an
algorithm
for
transforming
</del>
<ins class="diff-chg">consists
of
</ins>
an
<dfn title="iri_mapping" id="dfn-iri_mapping">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">(
iri
)
to
</del>
<ins class="diff-chg">mapping
</ins></dfn><ins class="diff-chg">
and
optionally
</ins>
a
<del class="diff-old">term
</del>
<dfn title="type_mapping" id="dfn-type_mapping">
<ins class="diff-chg">type
mapping
</ins></dfn><ins class="diff-chg">
from
terms
to
datatypes
</ins>
or
<del class="diff-old">compact
</del>
<dfn title="language_mapping" id="dfn-language_mapping">
<ins class="diff-chg">language
mapping
</ins></dfn><ins class="diff-chg">
from
terms
to
language
codes,
and
a
</ins><dfn title="container_mapping" id="dfn-container_mapping"><ins class="diff-chg">
container
mapping
</ins></dfn>.<ins class="diff-chg">
If
an
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-new">mapping
</ins></a><ins class="diff-new">
maps
a
term
to
multiple
</ins><tref="iri"><ins class="diff-new">
IRIs
it
is
said
to
be
a
</ins><dfn title="property_generator" id="dfn-property_generator"><ins class="diff-new">
property
generator
</ins></dfn>.</tref="iri">
</p>
<p>
<ins class="diff-new">If
a
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-new">
local
context
</ins>
</a>
<del class="diff-old">using
</del>
<ins class="diff-chg">is
encountered,
information
from
</ins>
the
<del class="diff-old">term
</del>
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
<ins class="diff-chg">local
context
</ins>
</a>
<del class="diff-old">s
specified
in
</del>
<ins class="diff-chg">is
merged
into
</ins>
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
<ins class="diff-new">A
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-new">
local
context
</ins>
</a>
<del class="diff-old">using
</del>
<ins class="diff-chg">is
identified
within
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
having
a
</ins><code><ins class="diff-chg">
@context
</ins></code><ins class="diff-chg">
member
with
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a>,<a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
or
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
value.
</ins></p><p><ins class="diff-chg">
This
algorithm
specifies
how
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
is
updated
with
a
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a>.<ins class="diff-chg">
The
algorithm
takes
three
input
variables:
</ins>
an
<del class="diff-old">optional
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
context
</ins></a>,<ins class="diff-chg">
a
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a>,<ins class="diff-chg">
and
an
array
of
already
included
remote
contexts
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">remoteContexts
</ins>
</em>.
<ins class="diff-new">To
begin,
</ins><em><ins class="diff-new">
remoteContexts
</ins></em><ins class="diff-new">
is
initialized
to
an
empty
array.
</ins>
</p>
<del class="diff-old">4.4.1
</del>
<p>
<ins class="diff-chg">All
calls
of
the
</ins><a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Compaction
Algorithm
The
</del>
<ins class="diff-chg">Expansion
</ins>
algorithm
<del class="diff-old">for
generating
a
compact
IRI
</del>
</a>
<del class="diff-old">is:
</del>
<ins class="diff-chg">pass
the
value
specified
in
the
algorithm
along
with
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
the
currently
being
processed
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a>,<ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
true
</ins></code><ins class="diff-chg">
for
the
</ins><em><ins class="diff-chg">
vocabRelative
</ins></em><ins class="diff-chg">
flag.
</ins>
</p>
<ol class="algorithm">
<li>
<del class="diff-old">Create
</del>
<ins class="diff-chg">If
the
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
is
not
</ins>
an
<del class="diff-old">empty
list
of
terms
</del>
<ins class="diff-chg">array,
transform
it
to
one.
</ins></li><li><ins class="diff-chg">
Process
each
item
</ins>
<em>
<del class="diff-old">terms
</del>
<ins class="diff-chg">context
</ins>
</em>
<del class="diff-old">that
will
be
populated
with
term
</del>
<ins class="diff-chg">of
the
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins>
</a>
<del class="diff-old">s
that
are
ranked
according
to
how
closely
they
match
value
.
Initialize
</del>
<ins class="diff-chg">as
follows:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins>
<em>
<del class="diff-old">highest
rank
</del>
<ins class="diff-chg">context
</ins>
</em>
<del class="diff-old">to
0
,
</del>
<ins class="diff-chg">equals
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
reset
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>
and
<del class="diff-old">set
</del>
<ins class="diff-chg">continue
with
the
next
item.
</ins></li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
context
</ins></em><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">flag
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
<ins class="diff-chg">string
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
Expand
</ins>
<em>
<del class="diff-old">list
container
</del>
<ins class="diff-chg">context
</ins>
</em>
<ins class="diff-new">according
</ins>
to
<del class="diff-old">false
.
</del>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
</ins></a>.
</li>
<li>
<del class="diff-old">For
each
</del>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">context
</ins>
</em>
<ins class="diff-new">is
</ins>
in
the
<del class="diff-old">active
</del>
<em>
<ins class="diff-chg">remoteContexts
</ins></em><ins class="diff-chg">
array,
raise
an
</ins><code class="error"><ins class="diff-chg">
RECURSIVE_CONTEXT_INCLUSION
</ins></code><ins class="diff-chg">
error.
Otherwise,
add
</ins><em>
context
<del class="diff-old">:
</del>
</em>
<ins class="diff-chg">to
</ins><em><ins class="diff-chg">
remoteContexts
</ins></em>.</li><li><ins class="diff-chg">
Dereference
</ins><em><ins class="diff-chg">
context
</ins></em>.</li>
<li>
If
the
<ins class="diff-new">resulting
document
is
a
JSON
document
consisting
of
a
top-level
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
that
has
a
</ins><code><ins class="diff-new">
@context
</ins></code><ins class="diff-new">
member
recursively
invoke
this
algorithm
passing
a
copy
of
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-new">
active
context
</ins></a>,<ins class="diff-new">
the
value
of
the
</ins><code><ins class="diff-new">
@context
</ins></code><ins class="diff-new">
member
as
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-new">
local
context
</ins></a>,<ins class="diff-new">
and
a
copy
of
the
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">remoteContexts
</ins>
</em>
<del class="diff-old">'s
</del>
<ins class="diff-chg">array.
</ins><a class="tref internalDFN" title="relative_iri" href="#dfn-relative_iri"><ins class="diff-chg">
Relative
IRIs
</ins></a><ins class="diff-chg">
are
expanded
using
the
remote
context's
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
<del class="diff-old">is
not
a
complete
match
against
iri
,
continue
to
</del>
</abbr>.
<ins class="diff-chg">Otherwise
raise
an
</ins><code class="error"><ins class="diff-chg">
INVALID_REMOTE_CONTEXT
</ins></code><ins class="diff-chg">
error.
</ins></li><li><ins class="diff-chg">
Continue
with
</ins>
the
next
<ins class="diff-new">item
from
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">context
</ins>
</em>.
</li>
</ol>
</li>
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">context
</ins>
</em>
is
<ins class="diff-new">not
</ins>
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
<del class="diff-old">containing
only
</del>
</a>,
<ins class="diff-chg">raise
an
</ins><code class="error"><ins class="diff-chg">
INVALID_LOCAL_CONTEXT
</ins></code><ins class="diff-chg">
error.
</ins></li><li><ins class="diff-chg">
Otherwise,
if
</ins><em><ins class="diff-chg">
context
</ins></em><ins class="diff-chg">
is
an
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>,<ins class="diff-chg">
perform
</ins>
the
<del class="diff-old">property
@list
:
</del>
<ins class="diff-chg">following
steps:
</ins>
<ol class="algorithm">
<li>
If
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">context
</ins>
</em>
has
a
<code>
<del class="diff-old">@container
</del>
<ins class="diff-chg">@vocab
</ins></code><ins class="diff-chg">
member:
if
its
value
is
neither
an
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,<ins class="diff-chg">
i.e.,
it
does
not
contain
a
colon
(
</ins><code>:</code><ins class="diff-chg">
),
nor
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_VOCAB_MAPPING
</ins>
</code>
<ins class="diff-new">error;
otherwise
</ins>
set
<ins class="diff-new">the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-new">
active
context's
</ins></a><a class="tref internalDFN" title="vocabulary_mapping" href="#dfn-vocabulary_mapping"><ins class="diff-new">
vocabulary
mapping
</ins></a>
to
<del class="diff-old">@set
,
continue
to
</del>
<ins class="diff-chg">its
value
and
remove
</ins>
the
<del class="diff-old">next
</del>
<code>
<ins class="diff-chg">@vocab
</ins></code><ins class="diff-chg">
member
from
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">context
</ins>
</em>.
</li>
<li>
If
<em>
<del class="diff-old">list
container
</del>
<ins class="diff-chg">context
</ins>
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">has
a
</ins>
<code>
<del class="diff-old">true
</del>
<ins class="diff-chg">@language
</ins>
</code>
<del class="diff-old">and
term
does
not
have
</del>
<ins class="diff-chg">member:
if
its
value
is
neither
</ins>
a
<del class="diff-old">container
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
<ins class="diff-chg">string
</ins></a><ins class="diff-chg">
nor
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_DEFAULT_LANGUAGE
</ins>
</code>
<ins class="diff-new">error;
otherwise
</ins>
set
<ins class="diff-new">the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-new">
active
context's
</ins></a><a class="tref internalDFN" title="default_language" href="#dfn-default_language"><ins class="diff-new">
default
language
</ins></a>
to
<ins class="diff-new">its
value
and
remove
the
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@language
</ins>
</code>
<del class="diff-old">and
</del>
<ins class="diff-chg">member
from
</ins><em><ins class="diff-chg">
context
</ins></em>.</li><li><ins class="diff-chg">
For
each
other
</ins><em><ins class="diff-chg">
key
</ins></em><ins class="diff-chg">
-
</ins>
<em>
value
</em>
<del class="diff-old">is
null
,
continue
to
</del>
<ins class="diff-chg">pair
in
</ins><em><ins class="diff-chg">
context
</ins></em><ins class="diff-chg">
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Remove
</ins>
the
<del class="diff-old">next
</del>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">key
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
pair
from
</ins><em><ins class="diff-chg">
context
</ins>
</em>.
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">key
</ins>
</em>
<del class="diff-old">has
</del>
<ins class="diff-chg">is
</ins>
a
<del class="diff-old">container
set
to
@list
,
</del>
<ins class="diff-chg">JSON-LD
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-chg">
keyword
</ins></a>,
continue
<del class="diff-old">to
</del>
<ins class="diff-chg">with
</ins>
the
next
<em>
<del class="diff-old">term
.
</del>
<ins class="diff-chg">key
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
pair.
</ins>
</li>
<li>
<del class="diff-old">Set
</del>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">rank
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">to
</del>
<ins class="diff-chg">equals
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
replace
</ins>
the
<a class="tref internalDFN" title="term_definition" href="#dfn-term_definition">
term
<del class="diff-old">rank
</del>
<ins class="diff-chg">definition
</ins>
</a>
<del class="diff-old">of
</del>
<ins class="diff-chg">for
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">key
</ins>
</em>
<del class="diff-old">by
passing
passing
term
,
value
,
and
</del>
<ins class="diff-chg">in
the
</ins>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<ins class="diff-new">with
an
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
mapping
</ins></a><ins class="diff-new">
set
</ins>
to
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-new">null
</ins></a><ins class="diff-new">
and
continue
with
</ins>
the
<del class="diff-old">Term
Rank
Algorithm
.
</del>
<ins class="diff-chg">next
</ins><em><ins class="diff-chg">
key
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
pair.
</ins>
</li>
<li>
If
<em>
<del class="diff-old">rank
</del>
<ins class="diff-chg">value
</ins>
</em>
is
<del class="diff-old">greater
than
0
:
If
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
expand
it
according
to
the
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a><ins class="diff-chg">
and
replace
the
</ins><a class="tref internalDFN" title="term_definition" href="#dfn-term_definition">
term
<ins class="diff-new">definition
</ins></a><ins class="diff-new">
for
</ins><em><ins class="diff-new">
key
</ins>
</em>
<del class="diff-old">has
a
container
</del>
<ins class="diff-chg">in
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
with
an
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a>
set
to
<del class="diff-old">@set
,
then
add
1
to
</del>
<ins class="diff-chg">the
expanded
</ins>
<em>
<del class="diff-old">rank
</del>
<ins class="diff-chg">value
</ins>
</em>.
<ins class="diff-new">Continue
with
the
next
</ins><em><ins class="diff-new">
key
</ins></em><ins class="diff-new">
-
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
pair.
</ins>
</li>
<li>
If
<em>
value
</em>
is
<ins class="diff-new">not
</ins>
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
<del class="diff-old">containing
only
the
property
@list
</del>
</a>,
<ins class="diff-chg">trigger
an
</ins><code class="error"><ins class="diff-chg">
INVALID_TERM_DEFINITION
</ins>
</code>
<del class="diff-old">and
</del>
<ins class="diff-chg">error
</ins></li><li><ins class="diff-chg">
If
</ins><a class="tref internalDFN" title="term_definition" href="#dfn-term_definition"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
for
</ins>
<em>
<del class="diff-old">list
container
</del>
<ins class="diff-chg">key
</ins>
</em>
<del class="diff-old">is
false
and
</del>
<ins class="diff-chg">exists
in
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
remove
it.
</ins></li><li><ins class="diff-chg">
Initialize
a
new,
empty
</ins><a class="tref internalDFN" title="term_definition" href="#dfn-term_definition">
term
<ins class="diff-new">definition
</ins></a><em><ins class="diff-new">
definition
</ins></em>.</li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
value
</ins>
</em>
has
<del class="diff-old">a
</del>
<ins class="diff-chg">an
</ins>
<code>
<del class="diff-old">container
</del>
<ins class="diff-chg">@id
</ins>
</code>
<del class="diff-old">set
to
@list
,
then
set
list
container
to
true
,
clear
</del>
<ins class="diff-chg">member
with
a
value
</ins>
<em>
<del class="diff-old">terms
,
set
</del>
<ins class="diff-chg">val
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
if
</ins>
<em>
<del class="diff-old">highest
rank
</del>
<ins class="diff-chg">val
</ins>
</em>
<del class="diff-old">to
rank
,
and
add
</del>
<ins class="diff-chg">is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">definition
</ins>
</em>
to
<em>
<del class="diff-old">terms
</del>
<ins class="diff-chg">val
</ins>
</em>.
</li>
<li>
<del class="diff-old">Otherwise,
</del>
if
<em>
<del class="diff-old">rank
</del>
<ins class="diff-chg">val
</ins>
</em>
is
<del class="diff-old">greater
than
or
equal
to
</del>
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
process
each
</ins>
<em>
<del class="diff-old">highest
rank
:
</del>
<ins class="diff-chg">item
</ins></em><ins class="diff-chg">
in
the
array:
</ins>
<ol class="algorithm">
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">if
</ins>
<em>
<del class="diff-old">rank
</del>
<ins class="diff-chg">item
</ins>
</em>
is
<del class="diff-old">greater
than
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
expand
it
according
the
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a>.</li><li><ins class="diff-chg">
otherwise,
raise
an
</ins><code class="error"><ins class="diff-chg">
INVALID_PROPERTY_GENERATOR
</ins></code><ins class="diff-chg">
error.
</ins></li></ol></li><li><ins class="diff-chg">
if
</ins>
<em>
<del class="diff-old">highest
rank
,
clear
</del>
<ins class="diff-chg">val
</ins></em><ins class="diff-chg">
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
lexicographically
sort
</ins>
<em>
<del class="diff-old">terms
</del>
<ins class="diff-chg">val
</ins>
</em>
and
set
<em>
<del class="diff-old">highest
rank
</del>
<ins class="diff-chg">definition
</ins>
</em>
to
<em>
<del class="diff-old">rank
</del>
<ins class="diff-chg">val
</ins>
</em>.
</li>
<li>
<del class="diff-old">Add
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">val
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
expand
it
according
the
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a><ins class="diff-chg">
and
set
</ins><em><ins class="diff-chg">
definition
</ins>
</em>
to
<em>
<del class="diff-old">terms
</del>
<ins class="diff-chg">val
</ins>
</em>.
</li>
</ol>
</li>
<li>
If
<ins class="diff-new">the
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
mapping
</ins></a><ins class="diff-new">
of
</ins>
<em>
<del class="diff-old">terms
</del>
<ins class="diff-chg">definition
</ins>
</em>
is
<del class="diff-old">empty,
and
the
active
context
</del>
<ins class="diff-chg">set
to
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins>
</a>
<del class="diff-old">has
a
@vocab
which
is
</del>
<ins class="diff-chg">or
</ins>
a
<del class="diff-old">prefix
of
</del>
<a class="tref internalDFN" title="keyword" href="#dfn-keyword">
<ins class="diff-chg">keyword
</ins></a>,<ins class="diff-chg">
store
the
</ins>
<em>
<del class="diff-old">iri
</del>
<ins class="diff-chg">definition
</ins>
</em>
<del class="diff-old">where
</del>
<ins class="diff-chg">as
</ins>
the
<del class="diff-old">resulting
relative
IRI
is
not
a
</del>
<a class="tref internalDFN" title="term_definition" href="#dfn-term_definition">
term
<ins class="diff-new">definition
</ins>
</a>
<ins class="diff-new">for
</ins><em><ins class="diff-new">
key
</ins></em>
in
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
<del class="diff-old">.
The
resulting
relative
IRI
</del>
</a>
<del class="diff-old">is
</del>
<ins class="diff-chg">and
continue
with
</ins>
the
<del class="diff-old">unmatched
part
of
</del>
<ins class="diff-chg">next
</ins>
<em>
<del class="diff-old">iri
</del>
<ins class="diff-chg">key
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
pair
from
</ins><em><ins class="diff-chg">
context
</ins>
</em>.
</li>
<li>
<del class="diff-old">If
terms
is
empty,
add
a
compact
</del>
<ins class="diff-chg">Otherwise,
set
the
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-chg">mapping
</ins>
</a>
<del class="diff-old">representation
</del>
of
<em>
<del class="diff-old">iri
</del>
<ins class="diff-chg">definition
</ins>
</em>
<del class="diff-old">for
each
term
in
the
active
context
which
maps
</del>
to
<del class="diff-old">an
</del>
<ins class="diff-chg">the
result
of
expanding
</ins><em><ins class="diff-chg">
key
</ins></em><ins class="diff-chg">
according
the
</ins><a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">which
is
</del>
<ins class="diff-chg">Expansion
algorithm
</ins></a>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
with
</ins>
a
<del class="diff-old">prefix
for
</del>
<ins class="diff-chg">value
</ins>
<em>
<del class="diff-old">iri
</del>
<ins class="diff-chg">val
</ins></em><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
val
</ins>
</em>
<del class="diff-old">where
the
resulting
compact
IRI
</del>
is
not
a
<del class="diff-old">term
</del>
<a class="tref internalDFN" title="string" href="#dfn-string">
<ins class="diff-chg">string
</ins>
</a>
<del class="diff-old">in
the
active
context
.
The
resulting
compact
</del>
<ins class="diff-chg">or
does
not
expand
to
an
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri"><ins class="diff-chg">
absolute
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
<del class="diff-old">is
the
term
associated
with
</del>
<ins class="diff-chg">using
</ins>
the
<del class="diff-old">partially
matched
</del>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">in
</del>
<ins class="diff-chg">Expansion
algorithm
</ins></a>,<ins class="diff-chg">
raise
an
</ins><code class="error"><ins class="diff-chg">
INVALID_TYPE_MAPPING
</ins></code><ins class="diff-chg">
error.
Otherwise
set
</ins>
the
<del class="diff-old">active
context
</del>
<a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins>
</a>
<del class="diff-old">concatenated
with
a
colon
(:)
character
and
the
unmatched
part
</del>
of
<em>
<del class="diff-old">iri
</del>
<ins class="diff-chg">definition
</ins></em><ins class="diff-chg">
to
the
expanded
</ins><em><ins class="diff-chg">
val
</ins>
</em>.
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
<em>
<del class="diff-old">terms
is
empty,
the
IRI
being
processed
is
a
property
or
the
</del>
value
<del class="diff-old">of
@type
and
</del>
</em>
<ins class="diff-chg">has
an
</ins>
<code>
<del class="diff-old">@vocab
</del>
<ins class="diff-chg">@language
</ins>
</code>
<ins class="diff-new">member
with
a
value
</ins><em><ins class="diff-new">
val
</ins></em><ins class="diff-new">
that
</ins>
is
<del class="diff-old">not
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
or
</ins><a class="tref internalDFN" title="null" href="#dfn-null">
null
<del class="diff-old">and
matches
</del>
</a>,
<ins class="diff-chg">set
</ins>
the
<del class="diff-old">beginning
</del>
<a class="tref internalDFN" title="language_mapping" href="#dfn-language_mapping">
<ins class="diff-chg">language
mapping
</ins></a>
of
<em>
<del class="diff-old">iri
,
return
</del>
<ins class="diff-chg">definition
</ins></em><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">unmatched
portion
of
</del>
<ins class="diff-chg">lowercased
</ins>
<em>
<del class="diff-old">iri
</del>
<ins class="diff-chg">val
</ins>
</em>.
<del class="diff-old">Otherwise
return
</del>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">iri
.
</del>
<ins class="diff-chg">val
</ins></em><ins class="diff-chg">
is
neither
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
nor
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
raise
an
</ins><code class="error"><ins class="diff-chg">
INVALID_LANGUAGE_MAPPING
</ins></code><ins class="diff-chg">
error.
</ins>
</li>
<li>
<del class="diff-old">Otherwise,
return
the
shortest
and
lexicographically
least
</del>
<ins class="diff-chg">f
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@container
</ins></code><ins class="diff-chg">
member
with
a
</ins>
value
<del class="diff-old">in
</del>
<em>
<del class="diff-old">terms
</del>
<ins class="diff-chg">val
</ins></em><ins class="diff-chg">
that
equals
</ins><code><ins class="diff-chg">
@list
</ins></code>,<code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@annotation
</ins></code>,<ins class="diff-chg">
set
the
</ins><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
of
</ins><em><ins class="diff-chg">
definition
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
val
</ins>
</em>.
<ins class="diff-new">If
</ins><em><ins class="diff-new">
val
</ins></em><ins class="diff-new">
is
not
one
of
those
values,
raise
an
</ins><code class="error"><ins class="diff-new">
INVALID_CONTAINER_MAPPING
</ins></code><ins class="diff-new">
error.
</ins></li></ol></li></ol></li></ol>
</li>
</ol>
</section>
<section id="iri-expansion">
<h3>
<span class="secno">
<del class="diff-old">4.4.2
</del>
<ins class="diff-chg">5.4
</ins>
</span>
<del class="diff-old">Term
Rank
Algorithm
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
</ins></h3>
<p>
<del class="diff-old">When
selecting
among
multiple
possible
terms
for
a
given
property,
it
may
be
that
multiple
terms
</del>
<ins class="diff-chg">In
JSON-LD
documents
keys
and
some
values
</ins>
are
<del class="diff-old">defined
with
the
same
</del>
<ins class="diff-chg">evaluated
to
produce
an
</ins>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">,
but
differ
in
@type
,
@container
or
@language
.
The
purpose
</del>
</a>.
<ins class="diff-chg">This
section
defines
an
algorithm
for
transforming
strings
representing
an
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
into
an
</ins><a class="tref internalDFN" title="absolute_iri" href="#dfn-absolute_iri"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.<ins class="diff-chg">
If
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
expansion
occurs
during
context
processing,
the
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
that
is
being
processed
is
passed
to
this
algorithm.
After
application
</ins>
of
this
<ins class="diff-new">algorithm,
values
processed
by
this
</ins>
algorithm
<del class="diff-old">is
</del>
<ins class="diff-chg">are
said
</ins>
to
<del class="diff-old">take
a
term
</del>
<ins class="diff-chg">be
in
</ins><dfn title="expanded_iri_form" id="dfn-expanded_iri_form"><ins class="diff-chg">
expanded
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
form
</ins></dfn>,<ins class="diff-chg">
although
this
may
also
include
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifiers
</ins>
</a>
and
<del class="diff-old">a
value
and
give
it
a
term
rank
.
The
selection
can
then
be
based,
partly,
on
the
term
having
the
highest
term
rank
</del>
<ins class="diff-chg">JSON-LD
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-chg">
keywords
</ins>
</a>.
</p>
<p>
<del class="diff-old">Given
</del>
<ins class="diff-chg">The
algorithm
takes
two
mandatory
and
four
optional
input
variables:
</ins>
a
<del class="diff-old">term
term
,
</del>
<em>
value
<del class="diff-old">,
and
</del>
</em>
<ins class="diff-chg">to
be
expanded,
an
</ins>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>,
<ins class="diff-new">two
flags
</ins><em><ins class="diff-new">
documentRelative
</ins></em><ins class="diff-new">
and
</ins><em><ins class="diff-new">
vocabRelative
</ins></em><ins class="diff-new">
specifying
whether
</ins><em><ins class="diff-new">
value
</ins></em><ins class="diff-new">
should
be
interpreted
as
</ins><a class="tref internalDFN" title="relative_iri" href="#dfn-relative_iri"><ins class="diff-new">
relative
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr>
</a>
<del class="diff-old">determine
</del>
<ins class="diff-chg">against
</ins>
the
<del class="diff-old">term
rank
</del>
<ins class="diff-chg">document's
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
or
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context's
</ins>
</a>
<del class="diff-old">using
</del>
<a class="tref internalDFN" title="vocabulary_mapping" href="#dfn-vocabulary_mapping">
<ins class="diff-chg">vocabulary
mapping
</ins></a>,<ins class="diff-chg">
along
with
an
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
passed
when
this
algorithm
is
used
in
</ins><a href="#context-processing"><ins class="diff-chg">
Context
Processing
</ins></a>,<ins class="diff-chg">
and
finally
an
array
</ins><em><ins class="diff-chg">
path
</ins></em><ins class="diff-chg">
which
is
used
to
detect
cyclic
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mappings
</ins></a>.<ins class="diff-chg">
If
not
passed,
</ins>
the
<del class="diff-old">following
steps:
</del>
<ins class="diff-chg">two
flags
are
set
to
</ins><code><ins class="diff-chg">
false
</ins></code><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
path
</ins></em><ins class="diff-chg">
is
initialized
to
an
empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
by
default.
</ins></p><p><ins class="diff-chg">
The
algorithm
for
generating
an
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
is:
</ins>
</p>
<ol class="algorithm">
<li>
If
<em>
value
</em>
is
<a class="tref internalDFN" title="null" href="#dfn-null">
null
<del class="diff-old">,
term
rank
</del>
</a>
<del class="diff-old">is
3
.
Otherwise,
if
</del>
<ins class="diff-chg">or
a
JSON-LD
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-chg">
keyword
</ins></a>,<ins class="diff-chg">
return
</ins>
<em>
value
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">as
is.
</ins></li><li><ins class="diff-chg">
If
</ins>
a
<del class="diff-old">JSON
object
</del>
<a class="tref internalDFN" title="local_context" href="#dfn-local_context">
<ins class="diff-chg">local
context
</ins>
</a>
<del class="diff-old">containing
only
the
property
@list
:
</del>
<ins class="diff-chg">has
been
passed
</ins>
<ol class="algorithm">
<li>
<del class="diff-old">If
the
@list
property
</del>
<ins class="diff-chg">and
</ins><em><ins class="diff-chg">
value
</ins></em>
is
<del class="diff-old">an
empty
array,
if
</del>
<ins class="diff-chg">in
the
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">path
</ins>
</em>
<del class="diff-old">has
@container
</del>
<ins class="diff-chg">array,
raise
a
</ins><code class="error"><ins class="diff-chg">
CYCLIC_IRI_MAPPING
</ins>
</code>
<del class="diff-old">set
</del>
<ins class="diff-chg">error.
Otherwise
append
</ins><em><ins class="diff-chg">
value
</ins></em>
to
<del class="diff-old">@list
,
term
rank
is
1
,
otherwise
0
.
</del>
<em>
<ins class="diff-chg">path
</ins></em>.
</li>
<li>
<del class="diff-old">Otherwise,
</del>
<ins class="diff-chg">If
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
contains
an
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
for
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
that
is
not
a
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator"><ins class="diff-chg">
property
generator
</ins></a>
return
the
<del class="diff-old">sum
</del>
<ins class="diff-chg">result
</ins>
of
<ins class="diff-new">recursively
calling
this
algorithm
passing
</ins>
the
<del class="diff-old">term
rank
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
</a>
<del class="diff-old">s
</del>
<ins class="diff-chg">of
the
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
as
new
</ins><em><ins class="diff-chg">
value
</ins></em>,<ins class="diff-chg">
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a>,<em><ins class="diff-chg">
path
</ins></em>,<ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
true
</ins></code>
for
<del class="diff-old">every
entry
in
</del>
the
<del class="diff-old">list.
</del>
<em>
<ins class="diff-chg">vocabRelative
</ins></em><ins class="diff-chg">
flag.
If
the
result
is
a
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator"><ins class="diff-chg">
property
generator
</ins></a>,<ins class="diff-chg">
raise
an
</ins><code class="error"><ins class="diff-chg">
PROPERTY_GENERATOR_IN_TERM_DEFINITION
</ins></code><ins class="diff-chg">
error.
</ins>
</li>
</ol>
</li>
<li>
<del class="diff-old">Otherwise,
</del>
<ins class="diff-chg">If
an
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
exists
for
</ins>
<em>
value
</em>
<del class="diff-old">must
be
a
node
definition
,
node
reference
,
or
a
JSON
object
</del>
<ins class="diff-chg">in
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins>
</a>
<del class="diff-old">having
</del>
<ins class="diff-chg">that
is
not
</ins>
a
<del class="diff-old">@value
.
</del>
<a class="tref internalDFN" title="property_generator" href="#dfn-property_generator">
<ins class="diff-chg">property
generator
</ins></a><ins class="diff-chg">
return
the
value
of
the
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a>.</li>
<li>
If
<em>
value
</em>
<del class="diff-old">has
</del>
<ins class="diff-chg">contains
</ins>
a
<del class="diff-old">@value
</del>
<ins class="diff-chg">colon
(
</ins><code>:
</code>
<del class="diff-old">property:
</del>
<ins class="diff-chg">),
perform
the
following
steps:
</ins>
<ol class="algorithm">
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Split
</ins>
<em>
value
</em>
<del class="diff-old">has
a
@type
property
matching
</del>
<ins class="diff-chg">into
</ins>
a
<del class="diff-old">@type
coercion
for
</del>
<em>
<del class="diff-old">term
,
term
rank
is
3
,
otherwise
if
</del>
<ins class="diff-chg">prefix
</ins></em><ins class="diff-chg">
and
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">suffix
</ins>
</em>
<del class="diff-old">has
no
@type
</del>
<ins class="diff-chg">at
the
first
occurrence
of
a
colon
(
</ins><code>:
</code>
<del class="diff-old">coercion
and
no
@language
,
term
rank
is
1
,
otherwise
0
.
</del>
<ins class="diff-chg">).
</ins>
</li>
<li>
<del class="diff-old">Otherwise,
if
@value
is
not
a
string
,
if
</del>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">suffix
</ins>
</em>
<del class="diff-old">has
no
</del>
<ins class="diff-chg">begins
with
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">//
</ins>
</code>
or
<em>
<ins class="diff-new">prefix
</ins></em><ins class="diff-new">
equals
</ins>
<code>
<del class="diff-old">@language
it
is
2
</del>
<ins class="diff-chg">_
</ins>
</code>,
<del class="diff-old">otherwise
1
.
Otherwise,
if
</del>
<ins class="diff-chg">return
</ins>
<em>
value
</em>
<ins class="diff-new">as
is.
</ins></li><li><ins class="diff-new">
If
a
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-new">
local
context
</ins></a>
has
<del class="diff-old">no
@language
property,
if
</del>
<ins class="diff-chg">been
passed,
expand
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">prefix
</ins>
</em>
<del class="diff-old">has
@language
null
,
or
</del>
<ins class="diff-chg">by
recursively
invoking
this
algorithm
passing
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">prefix
</ins>
</em>
<del class="diff-old">has
no
@type
or
@language
and
</del>
<ins class="diff-chg">as
</ins><em><ins class="diff-chg">
value
</ins></em>,
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<del class="diff-old">has
no
</del>
<ins class="diff-chg">and
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a>,<em><ins class="diff-chg">
path
</ins></em>,<ins class="diff-chg">
and
</ins>
<code>
<del class="diff-old">@language
,
term
rank
</del>
<ins class="diff-chg">true
</ins></code><ins class="diff-chg">
for
the
</ins><em><ins class="diff-chg">
vocabRelative
</ins></em><ins class="diff-chg">
flag.
If
the
expanded
</ins><em><ins class="diff-chg">
prefix
</ins></em><ins class="diff-chg">
contains
a
colon
(
</ins><code>:</code><ins class="diff-chg">
)
generate
and
return
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>
<del class="diff-old">is
3
,
otherwise
0
.
</del>
<ins class="diff-chg">by
prepending
the
expanded
</ins><em><ins class="diff-chg">
prefix
</ins></em><ins class="diff-chg">
to
the
(possibly
empty)
</ins><em><ins class="diff-chg">
suffix
</ins></em><ins class="diff-chg">
using
textual
concatenation.
</ins>
</li>
<li>
Otherwise,
if
<ins class="diff-new">the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-new">
active
context
</ins></a><ins class="diff-new">
contains
an
</ins><a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
mapping
</ins></a><ins class="diff-new">
for
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">prefix
</ins>
</em>
<del class="diff-old">has
</del>
<ins class="diff-chg">that
is
not
</ins>
a
<del class="diff-old">@language
</del>
<a class="tref internalDFN" title="property_generator" href="#dfn-property_generator">
property
<del class="diff-old">matching
a
@language
definition
for
</del>
<ins class="diff-chg">generator
</ins></a>,<ins class="diff-chg">
generate
and
return
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
by
prepending
the
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
mapped
to
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">prefix
</ins>
</em>
<del class="diff-old">(or
</del>
<ins class="diff-chg">to
the
(possibly
empty)
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">suffix
</ins>
</em>
<del class="diff-old">has
no
@type
or
</del>
<ins class="diff-chg">using
textual
concatenation.
</ins></li></ol></li><li><ins class="diff-chg">
Otherwise,
if
the
</ins><em><ins class="diff-chg">
vocabRelative
</ins></em><ins class="diff-chg">
flag
is
set
to
</ins>
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">true
</ins>
</code>
<del class="diff-old">definition
</del>
and
<del class="diff-old">@language
in
</del>
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<del class="diff-old">matches
</del>
<ins class="diff-chg">contains
a
</ins><a class="tref internalDFN" title="vocabulary_mapping" href="#dfn-vocabulary_mapping"><ins class="diff-chg">
vocabulary
mapping
</ins></a>,<ins class="diff-chg">
generate
and
return
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
by
prepending
</ins>
the
<del class="diff-old">value
@language
),
term
rank
</del>
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
</a>
<del class="diff-old">is
3
,
otherwise
if
</del>
<ins class="diff-chg">of
the
</ins><a class="tref internalDFN" title="vocabulary_mapping" href="#dfn-vocabulary_mapping"><ins class="diff-chg">
vocabulary
mapping
</ins></a><ins class="diff-chg">
to
the
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">has
no
@type
coercion
and
no
@language
,
term
rank
is
1
,
otherwise
0
.
</del>
<ins class="diff-chg">using
textual
concatenation.
</ins>
</li>
<li>
Otherwise,
if
<ins class="diff-new">the
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">documentRelative
</ins>
</em>
<del class="diff-old">has
@type
coerced
</del>
<ins class="diff-chg">flag
is
set
</ins>
to
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">true
</ins>
</code>,
<del class="diff-old">term
rank
</del>
<ins class="diff-chg">resolve
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
against
the
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
as
per
[
</ins><cite><a class="bibref" href="#bib-RFC3986"><ins class="diff-chg">
RFC3986
</ins></a></cite><ins class="diff-chg">
]
and
return
the
resulting
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.<ins class="diff-chg">
Only
the
basic
algorithm
in
section
5.2
of
[
</ins><cite><a class="bibref" href="#bib-RFC3986"><ins class="diff-chg">
RFC3986
</ins>
</a>
</cite>
<ins class="diff-new">]
</ins>
is
<del class="diff-old">3
,
otherwise
if
</del>
<ins class="diff-chg">used;
neither
</ins>
<em>
<del class="diff-old">term
</del>
<ins class="diff-chg">Syntax-Based
Normalization
</ins>
</em>
<del class="diff-old">has
no
@type
coercion
</del>
<ins class="diff-chg">nor
</ins><em><ins class="diff-chg">
Scheme-Based
Normalization
</ins></em><ins class="diff-chg">
(as
described
in
sections
6.2.2
</ins>
and
<del class="diff-old">no
@language
,
term
rank
</del>
<ins class="diff-chg">6.2.3
of
[
</ins><cite><a class="bibref" href="#bib-RFC3986"><ins class="diff-chg">
RFC3986
</ins>
</a>
<del class="diff-old">is
1
,
otherwise
0
.
</del>
</cite>
<ins class="diff-chg">])
are
performed.
Characters
additionally
allowed
in
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
references
are
treated
in
the
same
way
that
unreserved
characters
are
treated
in
URI
references,
per
section
6.5
of
[
</ins><cite><a class="bibref" href="#bib-RFC3987"><ins class="diff-chg">
RFC3987
</ins></a></cite><ins class="diff-chg">
]
</ins>
</li>
<li>
<del class="diff-old">Return
term
rank
.
</del>
<ins class="diff-chg">Otherwise
return
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
as
is.
</ins>
</li>
</ol>
<p>
<ins class="diff-chg">If
the
result
of
the
algorithm
above
is
a
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifier
</ins></a>,<ins class="diff-chg">
i.e.,
a
string
that
begins
with
</ins><code><ins class="diff-chg">
_:
</ins></code>,<ins class="diff-chg">
and
no
</ins><a class="tref internalDFN" title="local_context" href="#dfn-local_context"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
has
been
passed,
</ins><a href="#generate-blank-node-identifier"><ins class="diff-chg">
generated
a
new
blank
node
identifier
</ins></a><ins class="diff-chg">
before
returning
the
final
result.
</ins></p>
</section>
<section id="value-expansion">
<h3>
<span class="secno">
<del class="diff-old">4.5
</del>
<ins class="diff-chg">5.5
</ins>
</span>
Value
Expansion
</h3>
<p>
Some
values
in
JSON-LD
can
be
expressed
in
a
<del class="diff-old">compact
form.
</del>
<a class="tref internalDFN" title="compacted_form" href="#dfn-compacted_form">
<ins class="diff-chg">compacted
form
</ins></a>.
These
values
are
required
to
be
expanded
at
times
when
processing
JSON-LD
documents.
<ins class="diff-new">A
value
is
said
to
be
in
</ins><dfn title="expanded_form" id="dfn-expanded_form"><ins class="diff-new">
expanded
form
</ins></dfn><ins class="diff-new">
after
the
application
of
this
algorithm.
</ins>
</p>
<p>
The
algorithm
for
expanding
a
<em>
value
</em>
takes
an
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>.
It
is
implemented
as
follows:
</p>
<ol class="algorithm">
<li>
If
<em>
value
</em>
is
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>,
<del class="diff-old">the
</del>
<ins class="diff-chg">return
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>.</li><li><ins class="diff-chg">
Initialize
an
empty
object
</ins>
<em>
<del class="diff-old">value
is
already
expanded.
</del>
<ins class="diff-chg">result
</ins></em>.
</li>
<li>
If
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
is
<code>
@graph
</code>
or
the
<del class="diff-old">target
of
an
</del>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-chg">active
property's
</ins></a><a class="tref internalDFN" title="type_mapping" href="#dfn-type_mapping"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
is
set
to
</ins>
<code>
@id
<del class="diff-old">coercion,
expand
the
value
into
an
object
with
</del>
</code>,
<ins class="diff-chg">add
</ins>
a
key-value
pair
<ins class="diff-new">to
</ins><em><ins class="diff-new">
result
</ins></em>
where
the
key
is
<code>
@id
</code>
and
the
value
is
the
<del class="diff-old">expanded
IRI
</del>
<ins class="diff-chg">result
of
expanding
</ins><em><ins class="diff-chg">
value
</ins></em>
according
to
the
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
<ins class="diff-new">algorithm
</ins>
</a>
<del class="diff-old">rules.
Otherwise,
if
active
property
is
not
a
keyword
,
then
expand
</del>
<ins class="diff-chg">passing
</ins><code><ins class="diff-chg">
true
</ins></code><ins class="diff-chg">
for
the
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">documentRelative
</ins>
</em>
<del class="diff-old">into
an
object:
</del>
<ins class="diff-chg">flag.
Then
return
</ins><em><ins class="diff-chg">
result
</ins></em>.</li>
<li>
<del class="diff-old">Set
the
first
</del>
<ins class="diff-chg">Add
a
</ins>
key-value
pair
to
<em>
<ins class="diff-new">result
</ins></em><ins class="diff-new">
where
the
key
is
</ins>
<code>
@value
</code>
and
the
<del class="diff-old">unexpanded
</del>
<ins class="diff-chg">value
is
</ins>
<em>
value
</em>.
</li>
<li>
If
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
<del class="diff-old">is
the
target
of
typed
literal
coercion,
set
the
second
</del>
<ins class="diff-chg">has
a
</ins><a class="tref internalDFN" title="type_mapping" href="#dfn-type_mapping"><ins class="diff-chg">
type
mapping
</ins></a>,<ins class="diff-chg">
add
a
</ins>
key-value
pair
to
<em>
<ins class="diff-new">result
</ins></em><ins class="diff-new">
where
the
key
is
</ins>
<code>
@type
</code>
and
the
<del class="diff-old">associated
coercion
datatype
expanded
according
to
</del>
<ins class="diff-chg">value
is
</ins>
the
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
</del>
</a>
<del class="diff-old">rules.
</del>
<ins class="diff-chg">associated
with
the
</ins><a class="tref internalDFN" title="type_mapping" href="#dfn-type_mapping"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
or
a
newly
</ins><a href="#generate-blank-node-identifier"><ins class="diff-chg">
generated
blank
node
identifier
</ins></a><ins class="diff-chg">
if
the
</ins><a class="tref internalDFN" title="type_mapping" href="#dfn-type_mapping"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
is
set
to
a
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifier
</ins></a>.
</li>
<li>
Otherwise,
if
<em>
<ins class="diff-new">value
</ins></em><ins class="diff-new">
is
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-new">
string
</ins></a><ins class="diff-new">
and
</ins>
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
<del class="diff-old">is
the
target
of
</del>
<ins class="diff-chg">has
a
</ins><a class="tref internalDFN" title="language_mapping" href="#dfn-language_mapping">
language
<del class="diff-old">tagging,
</del>
<ins class="diff-chg">mapping
</ins></a><ins class="diff-chg">
or
an
</ins><a class="tref internalDFN" title="default_language" href="#dfn-default_language"><ins class="diff-chg">
default
language
</ins></a><ins class="diff-chg">
is
</ins>
set
<ins class="diff-new">in
</ins>
the
<del class="diff-old">second
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
context
</ins></a>,<ins class="diff-chg">
add
a
</ins>
key-value
pair
to
<em>
<ins class="diff-new">result
</ins></em><ins class="diff-new">
where
the
key
is
</ins>
<code>
@language
</code>
and
<ins class="diff-new">the
</ins>
value
<del class="diff-old">of
</del>
<ins class="diff-chg">is
</ins>
the
language
<del class="diff-old">tagging
from
</del>
<ins class="diff-chg">tag
associated
with
</ins>
the
<a class="tref internalDFN" title="language_mapping" href="#dfn-language_mapping">
<ins class="diff-chg">language
mapping
</ins></a><ins class="diff-chg">
or
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
<del class="diff-old">context
</del>
<ins class="diff-chg">property
</ins></a><ins class="diff-chg">
or
the
</ins><a class="tref internalDFN" title="default_language" href="#dfn-default_language"><ins class="diff-chg">
default
language
</ins>
</a>.
</li>
<li>
<del class="diff-old">Otherwise,
</del>
<ins class="diff-chg">Return
</ins>
<em>
<del class="diff-old">value
is
already
expanded.
</del>
<ins class="diff-chg">result
</ins></em>.
</li>
</ol>
</section>
<section id="label-blank-nodes-algorithm">
<h3>
<span class="secno">
<del class="diff-old">4.6
</del>
<ins class="diff-chg">5.6
</ins>
</span>
<del class="diff-old">Value
Compaction
</del>
<ins class="diff-chg">Label
Blank
Nodes
Algorithm
</ins>
</h3>
<p>
<del class="diff-old">Some
values,
such
as
IRIs
and
typed
literals
,
may
be
expressed
in
an
expanded
form
(
expanded
value
)
in
JSON-LD.
These
values
are
required
to
be
compacted
at
times
when
processing
JSON-LD
documents.
</del>
The
algorithm
<del class="diff-old">for
compacting
</del>
<ins class="diff-chg">takes
a
single
input
variable:
</ins>
an
<del class="diff-old">expanded
value
</del>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">takes
an
active
property
and
active
context
</del>
<ins class="diff-chg">to
be
labeled
with
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifiers
</ins>
</a>.
<del class="diff-old">It
is
implemented
as
follows:
</del>
</p>
<ol class="algorithm">
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">only
has
one
property
and
the
active
context
has
no
default
language,
then
the
compacted
value
</del>
is
<del class="diff-old">the
value
of
@value
.
</del>
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
recursively
apply
this
algorithm
to
all
its
items.
</ins>
</li>
<li>
Otherwise,
if
<del class="diff-old">active
property
is
@graph
,
the
compacted
value
</del>
<em>
<ins class="diff-chg">element
</ins></em>
is
<del class="diff-old">the
value
associated
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>
with
<del class="diff-old">the
</del>
<ins class="diff-chg">a
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@list
</ins>
</code>
<del class="diff-old">key,
processed
according
</del>
<ins class="diff-chg">member,
recursively
apply
this
algorithm
</ins>
to
<ins class="diff-new">all
items
of
</ins>
the
<del class="diff-old">IRI
Compaction
steps.
</del>
<code>
<ins class="diff-chg">@list
</ins></code><ins class="diff-chg">
member's
value.
</ins>
</li>
<li>
Otherwise,
if
<del class="diff-old">the
active
context
contains
</del>
<em>
<ins class="diff-chg">element
</ins></em><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">coercion
target
for
the
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins></a><ol class="algorithm"><li><ins class="diff-chg">
For
each
</ins><em>
key
<del class="diff-old">that
matches
the
expression
of
the
value,
compact
the
</del>
</em>
<ins class="diff-chg">-
</ins><em>
value
<del class="diff-old">using
the
following
steps:
</del>
</em>
<ins class="diff-chg">pair
ordered
by
</ins><em><ins class="diff-chg">
key
</ins></em><ins class="diff-chg">
recursively
apply
this
algorithm
to
</ins><em><ins class="diff-chg">
value
</ins></em>.</li>
<li>
If
<del class="diff-old">the
coercion
target
</del>
<em>
<ins class="diff-chg">element
</ins></em>
is
<ins class="diff-new">a
</ins><a class="tref internalDFN" title="node_object" href="#dfn-node_object"><ins class="diff-new">
node
object
</ins></a><ins class="diff-new">
without
</ins>
an
<code>
@id
<del class="diff-old">,
the
compacted
value
is
the
value
associated
with
the
</del>
</code>
<ins class="diff-chg">member,
create
a
new
</ins>
<code>
@id
</code>
<del class="diff-old">key,
processed
</del>
<ins class="diff-chg">member
and
assign
it
a
new
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifier
</ins></a>
according
<del class="diff-old">to
</del>
the
<del class="diff-old">IRI
Compaction
</del>
<a href="#generate-blank-node-identifier">
<ins class="diff-chg">Generate
Blank
Node
Identifier
</ins>
</a>
<del class="diff-old">steps.
</del>
<ins class="diff-chg">algorithm.
</ins>
</li>
<del class="diff-old">If
the
coercion
target
</del>
</ol>
</li>
</ol>
</section>
<section id="generate-blank-node-identifier">
<h3>
<span class="secno">
<ins class="diff-chg">5.7
</ins></span><ins class="diff-chg">
Generate
Blank
Node
Identifier
</ins></h3><p><ins class="diff-chg">
This
algorithm
</ins>
is
<ins class="diff-new">used
to
generate
new
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-new">
blank
node
identifiers
</ins></a><ins class="diff-new">
or
to
relabel
existing
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-new">
blank
node
identifiers
</ins></a><ins class="diff-new">
with
</ins>
a
<del class="diff-old">typed
literal
,
</del>
<ins class="diff-chg">new
one
to
avoid
collision
by
</ins>
the
<del class="diff-old">compacted
value
</del>
<ins class="diff-chg">introduction
of
new
ones.
It
needs
to
keep
an
</ins><em><ins class="diff-chg">
identifier
map
</ins></em>,<ins class="diff-chg">
a
</ins><em><ins class="diff-chg">
counter
</ins></em>,<ins class="diff-chg">
and
a
</ins><em><ins class="diff-chg">
prefix
</ins></em><ins class="diff-chg">
between
its
executions
to
be
able
to
generate
new
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifiers
</ins></a>.<ins class="diff-chg">
The
</ins><em><ins class="diff-chg">
counter
</ins></em>
is
<del class="diff-old">the
value
associated
with
the
</del>
<ins class="diff-chg">initialized
to
</ins>
<code>
<del class="diff-old">@value
</del>
<ins class="diff-chg">0
</ins>
</code>
<del class="diff-old">key.
Otherwise,
if
</del>
<ins class="diff-chg">and
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">prefix
</ins>
</em>
<del class="diff-old">contains
an
</del>
<ins class="diff-chg">is
set
to
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">_:t
</ins>
</code>
<del class="diff-old">key,
the
compacted
value
is
</del>
<ins class="diff-chg">by
default.
</ins></p><p><ins class="diff-chg">
The
algorithm
takes
a
single
input
variable
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">identifier
</ins>
</em>
<del class="diff-old">with
the
value
of
@id
processed
according
to
the
IRI
Compaction
steps.
</del>
<ins class="diff-chg">which
might
be
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>.</p><ol class="algorithm">
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">If
</ins>
the
<del class="diff-old">active
context
</del>
<em>
<ins class="diff-chg">identifier
</ins></em><ins class="diff-chg">
is
not
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins>
</a>
<del class="diff-old">contains
a
@language
,
which
matches
the
@language
of
the
value,
or
the
value
has
only
a
@value
key,
the
compacted
value
</del>
<ins class="diff-chg">and
</ins>
is
<ins class="diff-new">in
</ins>
the
<del class="diff-old">value
associated
with
</del>
<em>
<ins class="diff-chg">identifier
map
</ins></em>,<ins class="diff-chg">
return
</ins>
the
<del class="diff-old">@value
key.
</del>
<ins class="diff-chg">mapped
identifier.
</ins>
</li>
<li>
Otherwise,
<del class="diff-old">if
the
value
contains
</del>
<ins class="diff-chg">generate
</ins>
a
<del class="diff-old">@type
key,
the
compacted
value
is
</del>
<ins class="diff-chg">new
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">blankNodeIdentifier
</ins>
</em>
<del class="diff-old">with
the
</del>
<ins class="diff-chg">by
concatenating
</ins><em><ins class="diff-chg">
prefix
</ins></em><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
counter
</ins></em>.</li><li><ins class="diff-chg">
Increment
</ins><em><ins class="diff-chg">
counter
</ins></em><ins class="diff-chg">
by
</ins>
<code>
<del class="diff-old">@type
value
processed
according
to
the
IRI
Compaction
steps.
</del>
<ins class="diff-chg">1
</ins></code>.
</li>
<li>
<del class="diff-old">Otherwise,
the
value
</del>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
identifier
</ins></em>
is
not
<del class="diff-old">modified.
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,<ins class="diff-chg">
create
a
new
entry
in
</ins><em><ins class="diff-chg">
identifier
map
</ins></em><ins class="diff-chg">
set
to
</ins><em><ins class="diff-chg">
blankNodeIdentifer
</ins></em>.</li><li><ins class="diff-chg">
Return
</ins><em><ins class="diff-chg">
blankNodeIdentifier
</ins></em>.
</li>
</ol>
</section>
<section id="compaction-algorithm">
<h3>
<span class="secno">
<del class="diff-old">4.7
Expansion
Expansion
is
the
process
of
taking
a
JSON-LD
document
and
applying
a
context
such
that
all
IRI
,
datatypes,
and
literal
values
are
expanded
so
that
the
context
is
no
longer
necessary.
JSON-LD
document
expansion
is
typically
used
as
a
part
of
other
JSON-LD
API
methods.
For
example,
assume
the
following
JSON-LD
input
document:
{
   &quot;@context&quot;:
   {
      &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
      &quot;homepage&quot;: {
        &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
        &quot;@type&quot;, &quot;@id&quot;
      }
   },
   &quot;name&quot;: &quot;Manu Sporny&quot;,
   &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
}
Running
the
JSON-LD
Expansion
algorithm
against
the
JSON-LD
input
document
provided
above
would
result
in
the
following
output:
{
   &quot;http://xmlns.com/foaf/0.1/name&quot;: &quot;Manu Sporny&quot;,
   &quot;http://xmlns.com/foaf/0.1/homepage&quot;: {
      &quot;@id&quot;: &quot;http://manu.sporny.org/&quot;
   }
}
4.7.1
</del>
<ins class="diff-chg">5.8
</ins>
</span>
<del class="diff-old">Expansion
</del>
<ins class="diff-chg">Compaction
</ins>
Algorithm
</h3>
<p>
The
algorithm
takes
<del class="diff-old">three
</del>
<ins class="diff-chg">four
</ins>
input
variables:
an
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>,
an
<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context">
<ins class="diff-new">inverse
context
</ins></a>,<ins class="diff-new">
an
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>,
and
an
<em>
element
</em>
to
be
<del class="diff-old">expanded.
</del>
<ins class="diff-chg">compacted.
</ins>
To
begin,
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
is
set
to
the
result
of
<del class="diff-old">performing,
</del>
<ins class="diff-chg">performing
</ins>
<a href="#context-processing">
Context
Processing
</a>
on
the
passed
<em>
context
</em>,
<del class="diff-old">or
empty
if
</del>
<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context">
<ins class="diff-chg">inverse
</ins>
context
</a>
is
<del class="diff-old">null
</del>
<ins class="diff-chg">set
to
the
result
of
</ins><a href="#context-processing"><ins class="diff-chg">
creating
an
inverse
context
</ins></a><ins class="diff-chg">
from
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins>
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
is
set
to
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>,
and
<em>
element
</em>
is
set
to
the
<ins class="diff-new">result
of
performing
the
</ins><a href="#expansion-algorithm"><ins class="diff-new">
Expansion
Algorithm
</ins></a><ins class="diff-new">
on
the
</ins>
<a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input">
JSON-LD
input
</a>.
</p>
<ol class="algorithm">
<li>
If
<em>
element
</em>
is
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>,
<del class="diff-old">process
</del>
<ol class="algorithm">
<li>
<ins class="diff-chg">Initialize
a
new
empty
array
</ins><em><ins class="diff-chg">
result
</ins></em>.</li><li><ins class="diff-chg">
Process
</ins>
each
<del class="diff-old">entry
</del>
<ins class="diff-chg">item
</ins>
in
<em>
element
</em>
recursively
using
this
algorithm,
passing
<del class="diff-old">copies
</del>
<ins class="diff-chg">a
copy
</ins>
of
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>,
<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context">
<ins class="diff-chg">inverse
context
</ins></a>,
and
<ins class="diff-new">the
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
<ins class="diff-new">Add
each
compacted
item
to
</ins><em><ins class="diff-new">
result
</ins></em><ins class="diff-new">
unless
it
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a>.</li><li>
If
<em>
<ins class="diff-new">result
</ins></em>
has
a
<del class="diff-old">@container
</del>
<ins class="diff-chg">single
item
and
the
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays"><ins class="diff-chg">
compactArrays
</ins></a>
</code>
<ins class="diff-new">option
is
</ins>
set
to
<code>
<del class="diff-old">@list
and
any
entry
in
</del>
<ins class="diff-chg">true
</ins></code>,<ins class="diff-chg">
return
that
item;
otherwise
return
</ins><em><ins class="diff-chg">
result
</ins></em>.</li></ol></li><li><ins class="diff-chg">
If
</ins>
<em>
element
</em>
is
<del class="diff-old">an
array
,
or
is
</del>
<ins class="diff-chg">not
</ins>
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
<del class="diff-old">containing
a
@list
property,
</del>
<ins class="diff-chg">it
is
already
in
compact
form,
</ins>
return
<del class="diff-old">an
error,
</del>
<ins class="diff-chg">it
</ins>
as
<del class="diff-old">lists
of
lists
are
not
allowed.
If
the
expanded
entry
is
null,
drop
it.
</del>
<ins class="diff-chg">is.
</ins></li><li>
If
<del class="diff-old">it's
an
array,
merge
its
entries
with
</del>
<em>
element
</em>
<del class="diff-old">'s
entries.
Otherwise,
if
</del>
<ins class="diff-chg">has
an
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member,
replace
</ins>
<em>
element
</em>
<del class="diff-old">is
an
object
</del>
<ins class="diff-chg">with
the
result
of
the
</ins><a href="#value-compaction"><ins class="diff-chg">
Value
Compaction
algorithm
</ins></a>.
If
<ins class="diff-new">the
updated
</ins>
<em>
element
</em>
<del class="diff-old">has
</del>
<ins class="diff-chg">is
</ins>
a
<del class="diff-old">@context
property,
update
the
active
context
according
to
the
steps
outlined
in
Context
Processing
</del>
<a class="tref internalDFN" title="scalar" href="#dfn-scalar">
<ins class="diff-chg">scalar
</ins></a>,<ins class="diff-chg">
return
it
as
it
cannot
be
further
compacted.
</ins></li><li><ins class="diff-chg">
Initialize
a
new
empty
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins>
</a>
<del class="diff-old">and
remove
the
@context
property.
</del>
<ins class="diff-chg">result.
</ins>
</li>
<li>
<del class="diff-old">Then,
proceed
and
process
</del>
<ins class="diff-chg">Process
</ins>
each
<em>
property
</em>
and
<em>
value
</em>
in
<em>
element
</em>
<ins class="diff-new">ordered
by
</ins><em><ins class="diff-new">
property
</ins></em>
as
follows:
<ol class="algorithm">
<li>
<del class="diff-old">Remove
</del>
<ins class="diff-chg">If
</ins>
<em>
property
</em>
<del class="diff-old">from
element
,
expand
</del>
<ins class="diff-chg">is
a
JSON-LD
</ins><a class="tref internalDFN" title="keyword" href="#dfn-keyword"><ins class="diff-chg">
keyword
</ins></a><ol class="algorithm"><li><ins class="diff-chg">
and
</ins>
<em>
property
</em>
<ins class="diff-new">equals
</ins><code><ins class="diff-new">
@id
</ins></code>,<ins class="diff-new">
compact
</ins><em><ins class="diff-new">
value
</ins></em>
according
<del class="diff-old">to
</del>
the
<del class="diff-old">steps
outlined
in
</del>
<ins class="diff-chg">rules
of
the
</ins><a href="#iri-compaction-algorithm">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
</del>
<ins class="diff-chg">Compaction
algorithm
</ins>
</a>.
<del class="diff-old">Set
the
active
property
to
the
original
un-expanded
</del>
</li>
<li>
<ins class="diff-chg">Otherwise,
if
</ins>
<em>
property
</em>
<del class="diff-old">if
</del>
<ins class="diff-chg">equals
</ins><code><ins class="diff-chg">
@type
</ins></code>,<ins class="diff-chg">
compact
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">is
not
a
keyword
.
If
</del>
<ins class="diff-chg">(or
each
item
of
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">does
not
expand
to
a
keyword
or
</del>
<ins class="diff-chg">if
it
is
</ins>
an
<del class="diff-old">absolute
</del>
<a class="tref internalDFN" title="array" href="#dfn-array">
<ins class="diff-chg">array
</ins></a><ins class="diff-chg">
)
according
the
rules
of
the
</ins><a href="#iri-compaction-algorithm">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-chg">Compaction
algorithm
</ins>
</a>
<del class="diff-old">(i.e.,
it
doesn't
contain
a
colon),
continue
</del>
with
the
<del class="diff-old">next
property
from
</del>
<em>
<del class="diff-old">element
.
</del>
<ins class="diff-chg">vocabRelative
</ins></em><ins class="diff-chg">
flag
set
to
</ins><code><ins class="diff-chg">
true
</ins></code>.
If
<em>
value
</em>
is
<del class="diff-old">null
</del>
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">and
</del>
<ins class="diff-chg">consisting
of
just
one
item,
replace
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">is
not
@value
,
continue
</del>
with
<del class="diff-old">the
next
property
from
element
.
</del>
<ins class="diff-chg">that
item.
</ins>
</li>
<li>
<del class="diff-old">If
the
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
<em>
property
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">equals
</ins>
<code>
<del class="diff-old">@id
the
</del>
<ins class="diff-chg">@graph
</ins></code>,<ins class="diff-chg">
compact
</ins>
<em>
value
</em>
<del class="diff-old">must
be
</del>
<ins class="diff-chg">by
recursively
invoking
this
algorithm,
passing
</ins>
a
<del class="diff-old">string
.
Expand
</del>
<ins class="diff-chg">copy
of
</ins>
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-new">active
context
</ins></a>,<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-new">
inverse
context
</ins></a>,<ins class="diff-new">
and
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">property
</ins>
</em>
<del class="diff-old">according
</del>
<ins class="diff-chg">as
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
ensuring
that
the
result
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.</li><li><ins class="diff-chg">
Set
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>
to
<ins class="diff-chg">the
result
of
performing
</ins><a href="#iri-compaction-algorithm">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
.
</del>
<ins class="diff-chg">Compaction
</ins></a><ins class="diff-chg">
on
</ins><em><ins class="diff-chg">
property
</ins></em>.
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">Set
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
member
of
</ins><em><ins class="diff-chg">
result
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
value
</ins></em>.</li><li><ins class="diff-chg">
Continue
with
</ins>
the
<ins class="diff-new">next
</ins>
<em>
property
</em>
<del class="diff-old">is
@type
:
</del>
<ins class="diff-chg">-
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
pair
from
</ins><em><ins class="diff-chg">
element
</ins></em>.</li></ol></li>
<li>
If
<em>
value
</em>
is
<del class="diff-old">a
string
</del>
<ins class="diff-chg">an
empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins>
</a>,
<del class="diff-old">expand
according
</del>
<ol class="algorithm">
<li>
<ins class="diff-chg">set
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>
to
<ins class="diff-chg">the
result
of
performing
</ins><a href="#iri-compaction-algorithm">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
.
Otherwise,
if
</del>
<ins class="diff-chg">Compaction
</ins></a><ins class="diff-chg">
on
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">property
</ins></em><ins class="diff-chg">
with
the
</ins><em><ins class="diff-chg">
vocabRelative
</ins>
</em>
<ins class="diff-new">flag
set
to
</ins><code><ins class="diff-new">
true
</ins></code>.</li><li><ins class="diff-new">
If
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins></a>
is
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
<del class="diff-old">Object
</del>
<ins class="diff-chg">object
</ins>
</a>,
<ins class="diff-new">i.e.,
</ins>
it
<del class="diff-old">must
be
empty
(used
for
Framing
</del>
<ins class="diff-chg">is
a
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator"><ins class="diff-chg">
property
generator
</ins></a>,<ins class="diff-chg">
set
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins>
</a>
<del class="diff-old">).
</del>
<ins class="diff-chg">to
the
result
of
performing
the
</ins><a href="#find-and-remove-property-generator-duplicates"><ins class="diff-chg">
Find
and
Remove
Property
Generator
Duplicates
</ins></a><ins class="diff-chg">
algorithm
passing
</ins><em><ins class="diff-chg">
element
</ins></em>,<em><ins class="diff-chg">
property
</ins></em>,<a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
for
value,
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">Ensure
that
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">has
an
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
member;
if
not
create
it
and
set
its
value
to
</ins>
an
<ins class="diff-new">empty
</ins>
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">,
all
elements
must
be
string
s.
Expand
</del>
</a>.
</li>
<li>
<ins class="diff-chg">Continue
with
the
next
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
-
</ins>
<em>
value
</em>
<ins class="diff-new">pair
from
</ins><em><ins class="diff-new">
element
</ins></em>.</li></ol></li><li><ins class="diff-new">
Otherwise
perform
the
following
steps
</ins>
for
each
<em>
<ins class="diff-new">item
</ins></em>
of
<del class="diff-old">its
entries
according
</del>
<em>
<ins class="diff-chg">value
</ins></em>:<ol class="algorithm"><li><ins class="diff-chg">
Set
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>
to
<ins class="diff-chg">the
result
of
performing
</ins><a href="#iri-compaction-algorithm">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
.
</del>
<ins class="diff-chg">Compaction
</ins></a><ins class="diff-chg">
on
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
with
the
</ins><em><ins class="diff-chg">
vocabRelative
</ins></em><ins class="diff-chg">
flag
set
to
</ins><code><ins class="diff-chg">
true
</ins></code>.
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">If
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>,<ins class="diff-chg">
i.e.,
it
is
a
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator"><ins class="diff-chg">
property
generator
</ins></a>,<ins class="diff-chg">
set
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
to
the
result
of
performing
</ins>
the
<a href="#find-and-remove-property-generator-duplicates">
<ins class="diff-new">Find
and
Remove
Property
Generator
Duplicates
</ins></a><ins class="diff-new">
algorithm
passing
</ins><em><ins class="diff-new">
element
</ins></em>,
<em>
property
</em>,
<em>
<ins class="diff-chg">item
</ins></em>,<ins class="diff-chg">
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>.</li><li><ins class="diff-chg">
If
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property's
</ins></a><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
mapping
</ins></a>
is
<ins class="diff-new">set
to
</ins>
<code>
<del class="diff-old">@value
</del>
<ins class="diff-chg">@language
</ins>
</code>
or
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@annotation
</ins>
</code>
<del class="diff-old">the
</del>
<ol class="algorithm">
<li>
<ins class="diff-chg">Unless
</ins>
<em>
<del class="diff-old">value
must
not
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">be
a
</del>
<ins class="diff-chg">has
already
an
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
member,
create
one
and
initialize
its
value
to
an
empty
</ins>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
<del class="diff-old">or
an
array
</del>
</a>.
<ins class="diff-new">This
object
is
called
</ins><em><ins class="diff-new">
mapObject
</ins></em>.
</li>
<li>
<del class="diff-old">Otherwise,
if
the
</del>
<ins class="diff-chg">Set
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">index
</ins>
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">to
the
value
of
the
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@language
</ins>
</code>
or
<code>
<del class="diff-old">@set
</del>
<ins class="diff-chg">@annotation
</ins>
</code>
<del class="diff-old">expand
</del>
<ins class="diff-chg">member
of
</ins>
<em>
<ins class="diff-new">item
</ins></em><ins class="diff-new">
(depending
on
the
</ins>
value
<ins class="diff-new">of
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property's
</ins></a><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-new">
container
mapping
</ins></a><ins class="diff-new">
).
</ins></li><li><ins class="diff-new">
First
compact
</ins><em><ins class="diff-new">
item
</ins>
</em>
<del class="diff-old">recursively
</del>
using
<ins class="diff-new">the
</ins><a href="#value-compaction"><ins class="diff-new">
Value
Compaction
algorithm
</ins></a><ins class="diff-new">
passing
</ins><em><ins class="diff-new">
index
</ins></em><ins class="diff-new">
as
</ins><em><ins class="diff-new">
containerValue
</ins></em>,<ins class="diff-new">
then
compact
it
by
recursively
invoking
</ins>
this
<del class="diff-old">algorithm,
</del>
<ins class="diff-chg">algorithm
</ins>
passing
<del class="diff-old">copies
</del>
<ins class="diff-chg">a
copy
</ins>
of
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>,
<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context">
<ins class="diff-chg">inverse
context
</ins></a>,
and
<ins class="diff-chg">the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
<del class="diff-old">.
</del>
</a>.
</li>
<li>
If
<ins class="diff-new">no
</ins><em><ins class="diff-new">
index
</ins></em><ins class="diff-new">
member
exists
in
</ins>
the
<del class="diff-old">expanded
</del>
<em>
<ins class="diff-new">mapObject
</ins></em><ins class="diff-new">
create
one
and
set
its
</ins>
value
<ins class="diff-new">to
</ins><em><ins class="diff-new">
item
</ins>
</em>
<del class="diff-old">is
not
an
array
,
convert
</del>
<ins class="diff-chg">;
otherwise
append
</ins><em><ins class="diff-chg">
item
</ins></em><ins class="diff-chg">
to
the
</ins><em><ins class="diff-chg">
index
</ins></em><ins class="diff-chg">
member
(converting
</ins>
it
to
an
array
<del class="diff-old">.
If
</del>
<ins class="diff-chg">if
it
is
not
one
already).
</ins></li><li><ins class="diff-chg">
Continue
with
the
next
</ins>
<em>
property
</em>
<del class="diff-old">is
@list
and
any
entry
in
</del>
<ins class="diff-chg">-
</ins>
<em>
value
</em>
<ins class="diff-new">pair
from
</ins><em><ins class="diff-new">
element
</ins></em>.</li></ol></li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
item
</ins></em>
is
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
<del class="diff-old">containing
an
</del>
<ins class="diff-chg">having
a
</ins>
<code>
@list
</code>
<del class="diff-old">property,
return
an
error,
as
lists
</del>
<ins class="diff-chg">member,
</ins><ol class="algorithm"><li><ins class="diff-chg">
compact
the
value
</ins>
of
<del class="diff-old">lists
are
not
supported.
</del>
<ins class="diff-chg">that
member
by
recursively
invoking
this
algorithm
passing
a
copy
of
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>,<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a>,<ins class="diff-chg">
and
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
ensuring
that
the
result
is
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
expand
</del>
<ins class="diff-chg">If
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property's
</ins></a><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
is
set
to
</ins><code><ins class="diff-chg">
@list
</ins></code>,<ins class="diff-chg">
set
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
member
of
</ins><em><ins class="diff-chg">
result
</ins></em><ins class="diff-chg">
to
the
value
of
</ins><em><ins class="diff-chg">
item's
</ins></em><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
member.
If
such
an
member
already
exists
in
result,
raise
an
</ins><code class="error"><ins class="diff-chg">
COMPACTION_TO_LIST_OF_LISTS
</ins></code><ins class="diff-chg">
error;
otherwise
continue
with
the
next
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
-
</ins>
<em>
value
</em>
<ins class="diff-new">pair
from
</ins><em><ins class="diff-new">
element
</ins></em>.</li></ol></li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
item
</ins></em><ins class="diff-new">
is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a>,<ins class="diff-new">
compact
it
by
</ins>
recursively
<del class="diff-old">using
</del>
<ins class="diff-chg">invoking
</ins>
this
<del class="diff-old">algorithm,
</del>
<ins class="diff-chg">algorithm
</ins>
passing
<del class="diff-old">copies
</del>
<ins class="diff-chg">a
copy
</ins>
of
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>,
<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context">
<ins class="diff-chg">inverse
context
</ins></a>,
and
<ins class="diff-new">the
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
</li>
<li>
If
<ins class="diff-chg">no
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
</ins>
property
</a>
<ins class="diff-new">member
exists
in
</ins><em><ins class="diff-new">
result
</ins>
</em>
<del class="diff-old">is
not
a
keyword
</del>
<ins class="diff-chg">create
one
</ins>
and
<ins class="diff-new">set
its
value
to
</ins><em><ins class="diff-new">
item
</ins></em><ins class="diff-new">
;
otherwise
append
</ins><em><ins class="diff-new">
item
</ins></em><ins class="diff-new">
to
the
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
<del class="diff-old">has
a
</del>
<ins class="diff-chg">member
(converting
it
to
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
if
it
is
not
one
already).
</ins></li><li><ins class="diff-chg">
If
the
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays"><ins class="diff-chg">
compactArrays
</ins></a></code><ins class="diff-chg">
option
is
set
to
</ins>
<code>
<del class="diff-old">@container
</del>
<ins class="diff-chg">false
</ins>
</code>
<ins class="diff-new">or
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property's
</ins></a><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-new">
container
mapping
</ins></a><ins class="diff-new">
is
set
to
</ins>
<code>
@list
</code>
<del class="diff-old">and
</del>
<ins class="diff-chg">or
</ins><code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
convert
</ins>
the
<del class="diff-old">expanded
</del>
value
<ins class="diff-new">of
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
member
of
</ins><em><ins class="diff-new">
result
</ins>
</em>
<ins class="diff-new">to
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-new">
array
</ins></a><ins class="diff-new">
if
it
</ins>
is
not
<del class="diff-old">null
,
convert
</del>
<ins class="diff-chg">one
already.
</ins></li></ol></li></ol><p><ins class="diff-chg">
If,
after
the
algorithm
outlined
above
is
run,
the
resulting
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">to
</del>
<ins class="diff-chg">is
</ins>
an
<a class="tref internalDFN" title="array" href="#dfn-array">
<ins class="diff-chg">array
</ins></a><ins class="diff-chg">
replace
it
with
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
</ins>
object
</a>
with
<del class="diff-old">an
</del>
<ins class="diff-chg">a
single
member
whose
name
is
the
result
of
compacting
the
value
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@graph
</ins>
</code>
<del class="diff-old">property
</del>
<ins class="diff-chg">with
the
</ins><a href="#iri-compaction-algorithm"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Compaction
algorithm
</ins></a><ins class="diff-chg">
and
</ins>
whose
value
is
<del class="diff-old">set
</del>
<em>
<ins class="diff-chg">element
</ins></em>.<ins class="diff-chg">
Finally,
add
a
</ins><code><ins class="diff-chg">
@context
</ins></code><ins class="diff-chg">
property
</ins>
to
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">(unless
</del>
<ins class="diff-chg">and
set
it
to
the
initially
passed
</ins><em><ins class="diff-chg">
context
</ins></em>.</p></li></ol></section><section id="iri-compaction-algorithm"><h3><span class="secno"><ins class="diff-chg">
5.9
</ins></span><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Compaction
Algorithm
</ins></h3><p><ins class="diff-chg">
This
section
defines
an
algorithm
for
transforming
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
to
a
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
or
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri"><ins class="diff-chg">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.<ins class="diff-chg">
If
a
</ins>
<em>
value
</em>
is
<del class="diff-old">already
in
that
form).
Convert
</del>
<ins class="diff-chg">passed
it
is
used
to
choose
the
best
matching
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a>.</p><p><ins class="diff-chg">
This
algorithm
takes
three
mandatory
and
two
optional
parameters.
The
mandatory
parameters
are
the
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">iri
</ins>
</em>
to
<del class="diff-old">array
form
unless
</del>
<ins class="diff-chg">be
compacted,
an
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
and
an
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a>.<ins class="diff-chg">
Optionally
it
is
possible
to
pass
a
</ins>
<em>
value
</em>
<del class="diff-old">is
null
</del>
<ins class="diff-chg">and
a
</ins><em><ins class="diff-chg">
vocabRelative
</ins></em><ins class="diff-chg">
flag
which
specifies
whether
the
passed
</ins><em><ins class="diff-chg">
iri
</ins></em><ins class="diff-chg">
should
be
compacted
using
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context's
</ins>
</a>
<del class="diff-old">or
</del>
<a class="tref internalDFN" title="vocabulary_mapping" href="#dfn-vocabulary_mapping">
<ins class="diff-chg">vocabulary
mapping
</ins></a>.<ins class="diff-chg">
If
the
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">vocabRelative
</ins>
</em>
<ins class="diff-new">flag
</ins>
is
<ins class="diff-new">not
set
it
defaults
to
</ins>
<code>
<del class="diff-old">@id
,
@type
,
@value
,
or
@language
</del>
<ins class="diff-chg">false
</ins>
</code>.
</p>
<p>
<ins class="diff-chg">The
algorithm
for
generating
a
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri"><ins class="diff-chg">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
is:
</ins></p><ol class="algorithm">
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Initialize
a
variable
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">is
not
</del>
<ins class="diff-chg">to
</ins>
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>.
</li>
<li>
<ins class="diff-new">If
an
entry
for
</ins><em><ins class="diff-new">
iri
</ins></em><ins class="diff-new">
exists
in
the
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-new">
inverse
context
</ins>
</a>,
<del class="diff-old">either
merge
</del>
<ins class="diff-chg">perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
a
</ins>
<em>
value
</em>
<del class="diff-old">into
</del>
<ins class="diff-chg">has
been
passed,
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><em><ins class="diff-chg">
queryPath
</ins></em>,<ins class="diff-chg">
which
will
be
used
to
query
the
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a>,<ins class="diff-chg">
to
</ins>
an
<del class="diff-old">existing
</del>
<ins class="diff-chg">empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a></li><li id="calculate-value-profile-algorithm"><ins class="diff-chg">
Initialize
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">container
</ins>
</em>
<del class="diff-old">property
of
</del>
<ins class="diff-chg">to
</ins><code><ins class="diff-chg">
@set
</ins></code>,
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">typeOrLanguage
</ins></em>,<ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
typeLanguageValue
</ins>
</em>
<del class="diff-old">or
create
</del>
<ins class="diff-chg">to
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">new
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins></a><ol class="algorithm"><li><ins class="diff-chg">
and
it
has
an
</ins><code><ins class="diff-chg">
@annotation
</ins></code><ins class="diff-chg">
member,
set
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">container
</ins>
</em>
<del class="diff-old">property
with
</del>
<ins class="diff-chg">to
</ins><code><ins class="diff-chg">
@annotation
</ins></code>.</li><li><ins class="diff-chg">
If
</ins>
<em>
value
</em>
<del class="diff-old">as
value.
</del>
<ins class="diff-chg">has
an
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member,
set
</ins><em><ins class="diff-chg">
typeOrLanguage
</ins></em><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
typeLanguageValue
</ins></em><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
@id
</ins></code>.
</li>
<li>
<del class="diff-old">If
the
processed
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">value
</ins>
</em>
has
an
<code>
@value
</code>
<del class="diff-old">property
</del>
<ins class="diff-chg">member,
</ins>
<ol class="algorithm">
<li>
<ins class="diff-chg">and
an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member,
set
</ins>
<em>
<del class="diff-old">element
must
not
</del>
<ins class="diff-chg">typeOrLanguage
</ins>
</em>
<del class="diff-old">have
more
than
one
other
property,
which
can
either
be
</del>
<ins class="diff-chg">to
</ins>
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">or
</del>
<ins class="diff-chg">and
</ins><em><ins class="diff-chg">
typeLanguageValue
</ins></em><ins class="diff-chg">
to
the
value
of
the
</ins>
<code>
@type
</code>
<del class="diff-old">with
a
string
value.
</del>
<ins class="diff-chg">member
of
</ins><em><ins class="diff-chg">
value
</ins></em>.
</li>
<li>
<ins class="diff-new">Otherwise,
</ins>
if
<ins class="diff-new">it
has
an
</ins><code><ins class="diff-new">
@language
</ins></code><ins class="diff-new">
member,
set
</ins><em><ins class="diff-new">
typeOrLanguage
</ins></em><ins class="diff-new">
to
</ins><code><ins class="diff-new">
@language
</ins></code><ins class="diff-new">
and
</ins><em><ins class="diff-new">
typeLanguageValue
</ins></em><ins class="diff-new">
to
</ins>
the
value
of
<ins class="diff-new">the
</ins>
<code>
<del class="diff-old">@value
</del>
<ins class="diff-chg">@language
</ins>
</code>
<del class="diff-old">equals
null
,
replace
</del>
<ins class="diff-chg">member
of
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">value
</ins></em>.<ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins>
</em>
<del class="diff-old">with
</del>
<ins class="diff-chg">has
no
</ins><code><ins class="diff-chg">
@annotation
</ins></code><ins class="diff-chg">
member,
set
</ins><em><ins class="diff-chg">
container
</ins></em><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
@language
</ins></code></li><li><ins class="diff-chg">
Otherwise,
if
</ins>
the
value
of
<em>
<ins class="diff-new">value's
</ins></em>
<code>
@value
</code>
<ins class="diff-new">member
is
is
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-new">
string
</ins></a>,<ins class="diff-new">
set
</ins><em><ins class="diff-new">
typeOrLanguage
</ins></em><ins class="diff-new">
to
</ins><code><ins class="diff-new">
@language
</ins></code><ins class="diff-new">
and
</ins><em><ins class="diff-new">
typeLanguageValue
</ins></em><ins class="diff-new">
to
</ins><code><ins class="diff-new">
@null
</ins>
</code>.
</li>
</ol>
</li>
<li>
Otherwise,
if
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">value
</ins>
</em>
has
an
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@list
</ins>
</code>
<del class="diff-old">property
</del>
<ins class="diff-chg">member,
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
the
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
member
has
at
least
one
item,
update
</ins><em><ins class="diff-chg">
container
</ins></em>,<em><ins class="diff-chg">
typeOrLanguage
</ins></em>,
and
<del class="diff-old">its
value
is
</del>
<em>
<ins class="diff-chg">typeLanguageValue
</ins></em><ins class="diff-chg">
by
recursively
running
the
steps
</ins><a href="#calculate-value-profile-algorithm"><ins class="diff-chg">
2.1.2
</ins></a><ins class="diff-chg">
to
2.1.3.4
(which
will
never
be
true
since
list
of
lists
are
</ins>
not
<del class="diff-old">in
</del>
<ins class="diff-chg">allowed)
of
this
algorithm
passing
</ins>
the
<del class="diff-old">form
</del>
<ins class="diff-chg">first
item
</ins>
of
<del class="diff-old">an
array
,
convert
it
to
an
array
.
</del>
<em>
<ins class="diff-chg">value's
</ins></em><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
member
as
new
</ins><em><ins class="diff-chg">
value
</ins></em>.
</li>
<li>
If
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">value
</ins>
</em>
has
<del class="diff-old">an
</del>
<ins class="diff-chg">no
</ins>
<code>
<del class="diff-old">@set
</del>
<ins class="diff-chg">@annotation
</ins>
</code>
<del class="diff-old">or
</del>
<ins class="diff-chg">member,
set
</ins><em><ins class="diff-chg">
container
</ins></em><ins class="diff-chg">
to
</ins>
<code>
@list
<del class="diff-old">property,
it
must
</del>
</code>.
</li>
<li>
<ins class="diff-chg">Starting
from
the
second
item
of
</ins><em><ins class="diff-chg">
value's
</ins>
</em>
<code>
<ins class="diff-new">@list
</ins></code><ins class="diff-new">
member,
recursively
run
the
steps
</ins><a href="#calculate-value-profile-algorithm"><ins class="diff-new">
2.1.2
</ins></a><ins class="diff-new">
to
2.1.3.4
(which
will
never
</ins>
be
<ins class="diff-new">true
since
list
of
lists
are
not
allowed)
of
this
algorithm
passing
</ins>
the
<del class="diff-old">only
property.
Set
</del>
<ins class="diff-chg">item
as
new
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">value
</ins></em>.<ins class="diff-chg">
If
the
resulting
</ins><em><ins class="diff-chg">
typeOrLanguage
</ins>
</em>
<del class="diff-old">to
</del>
<ins class="diff-chg">or
</ins><em><ins class="diff-chg">
typeLanguageValue
</ins></em><ins class="diff-chg">
differ
from
</ins>
the
<ins class="diff-new">current
</ins>
value
of
<del class="diff-old">@set
;
leave
</del>
<em>
<ins class="diff-chg">typeOrLanguage
</ins></em><ins class="diff-chg">
or
</ins><em><ins class="diff-chg">
typeLanguageValue
</ins></em>,<ins class="diff-chg">
set
both
to
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
and
stop
processing
the
</ins>
<code>
@list
</code>
<del class="diff-old">untouched.
</del>
<ins class="diff-chg">items.
</ins></li></ol></li></ol>
</li>
<li>
If
<ins class="diff-new">the
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">container
</ins>
</em>
<del class="diff-old">has
just
a
</del>
<ins class="diff-chg">equals
</ins>
<code>
<del class="diff-old">@language
property,
</del>
<ins class="diff-chg">@list
</ins></code>,
set
<ins class="diff-new">the
first
item
of
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">queryPath
</ins>
</em>
to
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
consisting
of
the
two
elements
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
and
</ins><code>
null
<del class="diff-old">.
</del>
</code>
<ins class="diff-chg">;
otherwise
set
it
to
an
array
consisting
of
three
elements
where
the
first
element
is
the
value
of
</ins><em><ins class="diff-chg">
container
</ins></em><ins class="diff-chg">
and
the
other
two
elements
are
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
@null
</ins></code>.
</li>
<li>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
typeOrLanguage
</ins></em><ins class="diff-chg">
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
the
second
and
the
the
third
item
of
</ins><em><ins class="diff-chg">
queryPath
</ins></em><ins class="diff-chg">
to
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
consisting
of
a
single
element
</ins><code><ins class="diff-chg">
@null
</ins></code>.
</li>
<li>
Otherwise,
<del class="diff-old">expand
</del>
<ins class="diff-chg">set
the
second
item
of
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">queryPath
</ins>
</em>
<del class="diff-old">according
</del>
to
<del class="diff-old">the
Value
Expansion
</del>
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">rules,
passing
copies
</del>
<ins class="diff-chg">consisting
of
two
elements
where
the
first
element
is
the
value
</ins>
of
<em>
<ins class="diff-new">typeOrLanguage
</ins></em><ins class="diff-new">
and
</ins>
the
<del class="diff-old">active
context
</del>
<ins class="diff-chg">second
element
is
</ins><code><ins class="diff-chg">
@null
</ins></code>.<ins class="diff-chg">
Set
the
third
item
of
</ins><em><ins class="diff-chg">
queryPath
</ins></em><ins class="diff-chg">
to
an
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins>
</a>
<ins class="diff-new">whose
first
element
</ins><em><ins class="diff-new">
typeLanguageValue
</ins></em>
and
<del class="diff-old">active
property
.
</del>
<ins class="diff-chg">whose
second
element
is
</ins><code><ins class="diff-chg">
@null
</ins></code>.
</li>
<del class="diff-old">If,
after
</del>
<li>
<a href="#inverse-context-query-algorithm">
<ins class="diff-chg">Query
</ins>
the
<del class="diff-old">algorithm
outlined
above
is
run,
</del>
<ins class="diff-chg">inverse
context
</ins></a><ins class="diff-chg">
and
store
</ins>
the
<del class="diff-old">resulting
</del>
<ins class="diff-chg">result
in
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">result
</ins></em>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
result
</ins>
</em>
is
<del class="diff-old">an
</del>
<ins class="diff-chg">a
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
or
a
</ins>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
with
<del class="diff-old">just
</del>
a
<code>
<del class="diff-old">@graph
</del>
<ins class="diff-chg">term
</ins>
</code>
<del class="diff-old">property,
</del>
<ins class="diff-chg">member,
return
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">result
</ins></em>.</li></ol></li><li><ins class="diff-chg">
Otherwise,
if
the
entry
for
</ins><em><ins class="diff-chg">
iri
</ins>
</em>
<del class="diff-old">is
set
to
</del>
<ins class="diff-chg">in
</ins>
the
<del class="diff-old">value
of
</del>
<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context">
<ins class="diff-chg">inverse
context
</ins></a><ins class="diff-chg">
has
a
</ins>
<code>
<del class="diff-old">@graph
</del>
<ins class="diff-chg">term
</ins>
</code>
<del class="diff-old">'s
</del>
<ins class="diff-chg">member,
return
its
</ins>
value.
<del class="diff-old">Finally,
if
</del>
</li>
</ol>
</li>
<li>
<ins class="diff-chg">For
each
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">termIri
</ins>
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">-
</ins><em><ins class="diff-chg">
termDefinition
</ins></em><ins class="diff-chg">
pair
in
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a><ins class="diff-chg">
sorted
in
reverse
order
by
</ins><em><ins class="diff-chg">
termIri
</ins></em><ins class="diff-chg">
the
(longest
</ins><em><ins class="diff-chg">
termIri
</ins></em><ins class="diff-chg">
comes
first),
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
termDefinition
</ins></em><ins class="diff-chg">
does
not
have
</ins>
a
<del class="diff-old">JSON
object
,
</del>
<code>
<ins class="diff-chg">term
</ins></code><ins class="diff-chg">
member,
i.e.,
</ins>
it
is
<del class="diff-old">wrapped
into
an
array
</del>
<ins class="diff-chg">a
property
generator,
continue
with
the
next
</ins><em><ins class="diff-chg">
termIri
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
termDefinition
</ins></em><ins class="diff-chg">
pair
from
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins>
</a>.
<del class="diff-old">4.8
Compaction
Compaction
</del>
</li>
<li>
<ins class="diff-chg">Otherwise,
if
</ins><em><ins class="diff-chg">
iri
</ins></em><ins class="diff-chg">
begins
with
</ins><em><ins class="diff-chg">
termIri
</ins></em><ins class="diff-chg">
and
</ins>
is
<ins class="diff-new">longer
than
</ins><em><ins class="diff-new">
termIri
</ins></em>,<ins class="diff-new">
generate
a
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri"><ins class="diff-new">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
by
concatenating
</ins>
the
<del class="diff-old">process
</del>
<ins class="diff-chg">value
</ins>
of
<del class="diff-old">taking
</del>
<ins class="diff-chg">the
</ins><code><ins class="diff-chg">
term
</ins></code><ins class="diff-chg">
member
of
</ins><em><ins class="diff-chg">
termDefinition
</ins></em><ins class="diff-chg">
with
</ins>
a
<del class="diff-old">JSON-LD
document
</del>
<ins class="diff-chg">colon
(
</ins><code>:</code><ins class="diff-chg">
)
character
</ins>
and
<del class="diff-old">applying
a
context
such
that
</del>
the
<del class="diff-old">most
compact
form
</del>
<ins class="diff-chg">unmatched
part
</ins>
of
<em>
<ins class="diff-new">iri
</ins></em>.</li><li><ins class="diff-new">
If
</ins>
the
<del class="diff-old">document
is
generated.
JSON
is
typically
expressed
in
a
very
compact,
key-value
format.
That
is,
full
IRIs
are
rarely
used
as
keys.
At
times,
a
JSON-LD
document
may
be
received
that
is
not
in
its
most
compact
form.
JSON-LD,
via
the
API,
provides
a
way
to
</del>
<ins class="diff-chg">resulting
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
compact
<del class="diff-old">a
JSON-LD
document.
For
example,
assume
the
following
JSON-LD
input
document:
{
  &quot;http://xmlns.com/foaf/0.1/name&quot;: &quot;Manu Sporny&quot;,
  &quot;http://xmlns.com/foaf/0.1/homepage&quot;: {
    &quot;@id&quot;: &quot;http://manu.sporny.org/&quot;
  }
}
Additionally,
assume
the
following
developer-supplied
JSON-LD
context:
{
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  }
}
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
<del class="diff-old">Running
</del>
</a>
<ins class="diff-chg">has
an
entry
in
</ins>
the
<del class="diff-old">JSON-LD
Compaction
algorithm
given
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
context
</ins></a>,<ins class="diff-chg">
continue
with
</ins>
the
<ins class="diff-new">next
</ins><em><ins class="diff-new">
termIri
</ins></em><ins class="diff-new">
-
</ins><em><ins class="diff-new">
termDefinition
</ins></em><ins class="diff-new">
pair
from
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-new">
inverse
</ins>
context
<del class="diff-old">supplied
above
against
</del>
</a>
<ins class="diff-chg">as
</ins>
the
<del class="diff-old">JSON-LD
input
document
provided
above
would
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
cannot
be
used.
</ins></li><li><ins class="diff-chg">
Otherwise,
if
</ins>
result
<del class="diff-old">in
</del>
<ins class="diff-chg">is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
return
</ins>
the
<del class="diff-old">following
output:
{
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  },
  &quot;name&quot;: &quot;Manu Sporny&quot;,
  &quot;homepage&quot;: &quot;http://manu.sporny.org/&quot;
}
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
<del class="diff-old">The
compaction
algorithm
also
enables
the
developer
to
map
any
expanded
format
into
an
application-specific
compacted
format.
While
</del>
</a>
<ins class="diff-chg">;
if
it
is
not
null,
set
</ins>
the
<del class="diff-old">context
provided
above
mapped
</del>
<code>
<del class="diff-old">http://xmlns.com/foaf/0.1/name
</del>
<ins class="diff-chg">term
</ins>
</code>
<ins class="diff-new">member
of
</ins><em><ins class="diff-new">
result
</ins></em>
to
<del class="diff-old">name
,
it
could
have
also
mapped
it
to
any
arbitrary
string
provided
by
</del>
the
<del class="diff-old">developer.
</del>
<a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri">
<ins class="diff-chg">compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
<del class="diff-old">4.8.1
Compaction
Algorithm
The
algorithm
takes
three
input
variables:
an
active
context
,
an
active
property
,
</del>
</a>
and
<del class="diff-old">an
</del>
<ins class="diff-chg">return
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">result
</ins></em>.</li></ol></li><li><ins class="diff-chg">
If
the
</ins><em><ins class="diff-chg">
vocabRelative
</ins>
</em>
<ins class="diff-new">flag
is
set
</ins>
to
<del class="diff-old">be
compacted.
To
begin,
</del>
<code>
<ins class="diff-chg">true
</ins></code>,
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<del class="diff-old">is
set
to
</del>
<ins class="diff-chg">has
a
</ins><a class="tref internalDFN" title="vocabulary_mapping" href="#dfn-vocabulary_mapping"><ins class="diff-chg">
vocabulary
mapping
</ins></a>,<ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
iri
</ins></em><ins class="diff-chg">
begins
with
</ins>
the
<del class="diff-old">result
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
of
<del class="diff-old">performing
Context
Processing
</del>
<ins class="diff-chg">the
</ins><a class="tref internalDFN" title="vocabulary_mapping" href="#dfn-vocabulary_mapping"><ins class="diff-chg">
vocabulary
mapping
</ins>
</a>
<del class="diff-old">on
</del>
<ins class="diff-chg">but
is
longer
</ins><ol class="algorithm"><li><ins class="diff-chg">
Set
</ins><em><ins class="diff-chg">
vocabIri
</ins></em><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">passed
</del>
<ins class="diff-chg">unmatched
part
of
</ins>
<em>
<del class="diff-old">context
,
</del>
<ins class="diff-chg">iri
</ins></em>.</li><li><ins class="diff-chg">
If
there
does
not
exist
an
entry
for
</ins><em><ins class="diff-chg">
vocabIri
</ins></em><ins class="diff-chg">
in
the
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
<del class="diff-old">property
</del>
<ins class="diff-chg">context
</ins></a>,<ins class="diff-chg">
return
</ins><em><ins class="diff-chg">
vocabIri
</ins></em><ins class="diff-chg">
if
</ins><em><ins class="diff-chg">
result
</ins></em><ins class="diff-chg">
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins>
</a>
<ins class="diff-new">;
if
it
</ins>
is
<ins class="diff-new">not
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a>
set
<ins class="diff-new">the
</ins><code><ins class="diff-new">
term
</ins></code><ins class="diff-new">
member
of
</ins><em><ins class="diff-new">
result
</ins></em>
to
<em>
<ins class="diff-new">vocabIri
</ins></em><ins class="diff-new">
and
return
</ins><em><ins class="diff-new">
result
</ins></em>.</li></ol></li><li><ins class="diff-new">
If
</ins><em><ins class="diff-new">
result
</ins></em><ins class="diff-new">
is
</ins>
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>,
<del class="diff-old">and
</del>
<ins class="diff-chg">return
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">iri
</ins>
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">as
is.
</ins></li><li><ins class="diff-chg">
Otherwise
</ins>
set
<del class="diff-old">to
</del>
the
<del class="diff-old">result
</del>
<code>
<ins class="diff-chg">term
</ins></code><ins class="diff-chg">
member
</ins>
of
<del class="diff-old">performing
</del>
<em>
<ins class="diff-chg">result
</ins></em><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
iri
</ins></em><ins class="diff-chg">
and
return
</ins><em><ins class="diff-chg">
result
</ins></em>.</li></ol></section><section id="inverse-context-creation"><h3><span class="secno"><ins class="diff-chg">
5.10
</ins></span><ins class="diff-chg">
Inverse
Context
Creation
</ins></h3><p><ins class="diff-chg">
An
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
as
produced
by
</ins>
the
<del class="diff-old">Expansion
Algorithm
</del>
<a href="#context-processing">
<ins class="diff-chg">Context
Processing
</ins>
</a>
<del class="diff-old">on
</del>
<ins class="diff-chg">algorithm
is
very
efficient
for
</ins><a href="#iri-expansion"><ins class="diff-chg">
expanding
</ins></a><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
and
</ins><a class="tref internalDFN" title="compact_iri" href="#dfn-compact_iri"><ins class="diff-chg">
compact
IRIs
</ins></a><ins class="diff-chg">
to
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><ins class="diff-chg">
IRIs
</ins></a><ins class="diff-chg">
but
is
of
limited
use
for
</ins>
the
<del class="diff-old">JSON-LD
input
</del>
<ins class="diff-chg">opposite
operation:
</ins><a href="#iri-compaction-algorithm"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
compaction
</ins>
</a>.
<del class="diff-old">This
removes
any
existing
</del>
<ins class="diff-chg">Hence,
this
algorithm
introduces
the
notion
of
an
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
</ins>
context
</a>
<ins class="diff-new">which
brings
the
same
efficiency
</ins>
to
<a href="#iri-compaction-algorithm">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-new">IRI
</ins></abbr><ins class="diff-new">
compaction
</ins></a>.<ins class="diff-new">
An
</ins><dfn title="inverse_context" id="dfn-inverse_context"><ins class="diff-new">
inverse
context
</ins></dfn><ins class="diff-new">
a
tree
of
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
objects
</ins></a><ins class="diff-new">
which
</ins>
allow
<del class="diff-old">the
given
</del>
<ins class="diff-chg">to
efficiently
select
a
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
for
a
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
-value
pair.
</ins></p><p><ins class="diff-chg">
The
value
takes
an
</ins>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<del class="diff-old">to
be
cleanly
applied.
</del>
<ins class="diff-chg">and
returns
the
corresponding
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a>.
</p>
<ol class="algorithm">
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Set
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">defaultLanguage
</ins>
</em>
<ins class="diff-new">to
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-new">
active
context's
</ins></a><ins class="diff-new">
default
language
if
there
</ins>
is
<del class="diff-old">an
array
,
process
</del>
<ins class="diff-chg">one;
otherwise
set
it
to
</ins><code><ins class="diff-chg">
@null
</ins></code>.</li><li><ins class="diff-chg">
For
</ins>
each
<del class="diff-old">entry
</del>
<a class="tref internalDFN" title="term_definition" href="#dfn-term_definition">
<ins class="diff-chg">term
definition
</ins></a>
in
<del class="diff-old">element
recursively
using
this
algorithm,
passing
a
copy
of
</del>
the
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
active
context
</a>
<del class="diff-old">and
</del>
<ins class="diff-chg">perform
</ins>
the
<del class="diff-old">active
property
.
</del>
<ins class="diff-chg">following
steps:
</ins><ol class="algorithm"><li>
If
<del class="diff-old">element
has
a
single
item
and
</del>
the
<del class="diff-old">compactArrays
</del>
<a class="tref internalDFN" title="term" href="#dfn-term">
<ins class="diff-chg">term's
</ins>
</a>
<a class="tref internalDFN" title="iri_mapping" href="#dfn-iri_mapping">
<del class="diff-old">option
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a>
is
set
to
<del class="diff-old">true
,
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a><ins class="diff-chg">
continue
with
</ins>
the
<del class="diff-old">compacted
value
is
that
item;
otherwise
</del>
<ins class="diff-chg">next
</ins><a class="tref internalDFN" title="term_definition" href="#dfn-term_definition"><ins class="diff-chg">
term
definition
</ins></a>.</li><li><ins class="diff-chg">
Set
</ins><em><ins class="diff-chg">
container
</ins></em><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">compacted
</del>
value
<del class="diff-old">is
element
.
</del>
<ins class="diff-chg">of
the
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term's
</ins></a><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@null
</ins></code><ins class="diff-chg">
if
no
such
mapping
exists.
</ins>
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">If
the
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator"><ins class="diff-chg">
property
generator
</ins></a>,<ins class="diff-chg">
set
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">termType
</ins>
</em>
<del class="diff-old">is
an
object:
</del>
<ins class="diff-chg">to
</ins><code><ins class="diff-chg">
propertyGenerators
</ins></code>.</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise
set
set
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">termType
</ins>
</em>
<del class="diff-old">has
an
</del>
<ins class="diff-chg">to
</ins>
<code>
<del class="diff-old">@value
</del>
<ins class="diff-chg">term
</ins>
</code>
<del class="diff-old">property
or
element
is
a
node
reference
,
return
</del>
<ins class="diff-chg">and
append
</ins>
the
<del class="diff-old">result
</del>
<a class="tref internalDFN" title="term" href="#dfn-term">
<ins class="diff-chg">term
</ins></a><ins class="diff-chg">
to
the
</ins><code><ins class="diff-chg">
term
</ins></code><ins class="diff-chg">
member
</ins>
of
<del class="diff-old">performing
Value
Compaction
</del>
<ins class="diff-chg">the
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins>
</a>
<del class="diff-old">on
</del>
<ins class="diff-chg">for
the
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term's
</ins></a><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
in
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a><ins class="diff-chg">
(append
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">term
</ins>
</em>
<del class="diff-old">using
active
property
.
</del>
<ins class="diff-chg">to
</ins><code><ins class="diff-chg">
inverseContext[iri]['term']
</ins></code><ins class="diff-chg">
).
</ins></li><li><ins class="diff-chg">
For
each
</ins><em><ins class="diff-chg">
iri
</ins></em><ins class="diff-chg">
mapped
to
the
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a>,<ins class="diff-chg">
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
the
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
has
a
</ins><a class="tref internalDFN" title="type_mapping" href="#dfn-type_mapping"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
to
</ins><em><ins class="diff-chg">
type
</ins></em>,<ins class="diff-chg">
append
the
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
inverseContext[iri][container]['@type'][type][termType]
</ins></code>,<ins class="diff-chg">
e.g.,
</ins><code><ins class="diff-chg">
inverseContext['http://...']['@list']['@type']['http://...']['term']
</ins></code>.
</li>
<li>
Otherwise,
if
the
<del class="diff-old">active
property
</del>
<a class="tref internalDFN" title="term" href="#dfn-term">
<ins class="diff-chg">term
</ins>
</a>
has
a
<del class="diff-old">@container
</del>
<a class="tref internalDFN" title="language_mapping" href="#dfn-language_mapping">
<ins class="diff-chg">language
</ins>
mapping
</a>
<ins class="diff-new">store
the
associated
language
in
</ins><em><ins class="diff-new">
language
</ins></em>,<ins class="diff-new">
replacing
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
with
</ins><code><ins class="diff-new">
@null
</ins></code>.<ins class="diff-new">
Then
append
the
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-new">
term
</ins></a>
to
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">inverseContext[iri][container]['@language'][language][termType]
</ins></code>,<ins class="diff-chg">
e.g.,
</ins><code><ins class="diff-chg">
inverseContext['http://...']['@list']['@language']['de']['term']
</ins></code>.</li><li><ins class="diff-chg">
Otherwise
append
the
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
inverseContext[iri][container]['@null']['@null'][termType]
</ins></code><ins class="diff-chg">
as
well
as
</ins><code><ins class="diff-chg">
inverseContext[iri][container]['@language'][defaultLanguage][termType]
</ins>
</code>
<ins class="diff-new">to
take
the
</ins><a class="tref internalDFN" title="default_language" href="#dfn-default_language"><ins class="diff-new">
default
language
</ins></a><ins class="diff-new">
into
consideration
for
terms
without
explicit
</ins><a class="tref internalDFN" title="language_mapping" href="#dfn-language_mapping"><ins class="diff-new">
language
mapping
</ins></a>.</li></ol></li></ol></li><li><ins class="diff-new">
Remove
all
but
the
shortest
</ins>
and
<del class="diff-old">element
has
</del>
<ins class="diff-chg">lexicographically
least
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
in
each
</ins><code><ins class="diff-chg">
term
</ins></code><ins class="diff-chg">
member
in
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a>.<ins class="diff-chg">
The
result
is
thus
</ins>
a
<del class="diff-old">corresponding
</del>
<ins class="diff-chg">single
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
value.
</ins></li><li><ins class="diff-chg">
Finally,
sort
the
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
associated
with
every
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">propertyGenerators
</ins>
</code>
<del class="diff-old">property,
recursively
compact
</del>
<ins class="diff-chg">member
in
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a><ins class="diff-chg">
lexicographically
(shortest
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
come
first).
</ins></li></ol></section><section id="inverse-context-query-algorithm"><h3><span class="secno"><ins class="diff-chg">
5.11
</ins></span><ins class="diff-chg">
Inverse
Context
Query
Algorithm
</ins></h3><p><ins class="diff-chg">
It
is
possible
</ins>
that
<del class="diff-old">property's
value
passing
a
copy
</del>
<ins class="diff-chg">multiple
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
that
differ
in
their
</ins><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
</ins></a>,<a class="tref internalDFN" title="type_mapping" href="#dfn-type_mapping"><ins class="diff-chg">
type
</ins></a>,<ins class="diff-chg">
or
</ins><a class="tref internalDFN" title="language_mapping" href="#dfn-language_mapping"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
are
mapped
to
the
same
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.<ins class="diff-chg">
The
purpose
</ins>
of
<ins class="diff-new">this
algorithm
is
to
query
</ins>
the
<del class="diff-old">active
</del>
<a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context">
<ins class="diff-chg">inverse
</ins>
context
</a>
<del class="diff-old">and
</del>
<ins class="diff-chg">to
return
either
</ins>
the
<del class="diff-old">active
</del>
<ins class="diff-chg">best
matching
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a>,<ins class="diff-chg">
or
a
list
of
potential
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator">
property
<ins class="diff-new">generators
</ins>
</a>
<del class="diff-old">ensuring
that
the
result
is
an
array
</del>
<ins class="diff-chg">along
</ins>
with
<del class="diff-old">all
null
values
removed.
If
there
already
exists
</del>
a
<del class="diff-old">value
for
active
</del>
<a class="tref internalDFN" title="term" href="#dfn-term">
<ins class="diff-chg">term
</ins></a><ins class="diff-chg">
to
fall
back
to
if
none
of
the
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator">
property
<ins class="diff-new">generators
</ins>
</a>
<del class="diff-old">in
</del>
<ins class="diff-chg">can
be
applied.
</ins></p><p><ins class="diff-chg">
This
algorithm
takes
an
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">inverseContextSubtree
</ins></em>,<ins class="diff-chg">
a
</ins><em><ins class="diff-chg">
queryPath
</ins>
</em>
<del class="diff-old">and
</del>
<ins class="diff-chg">as
generated
by
</ins>
the
<del class="diff-old">full
</del>
<a href="#iri-compaction-algorithm">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">of
</del>
<ins class="diff-chg">Compaction
algorithm
</ins></a><ins class="diff-chg">
and
a
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">level
</ins>
</em>
<ins class="diff-new">parameter
which
</ins>
is
<del class="diff-old">also
coerced
</del>
<ins class="diff-chg">initialized
</ins>
to
<code>
<del class="diff-old">@list
,
return
an
error.
Otherwise
store
</del>
<ins class="diff-chg">0
</ins></code><ins class="diff-chg">
if
nothing
else
is
passed.
The
algorithm
returns
either
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
representing
</ins>
the
<del class="diff-old">resulting
</del>
<ins class="diff-chg">best
matching
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
or
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
consisting
of
a
</ins><code><ins class="diff-chg">
propertyGenerators
</ins></code><ins class="diff-chg">
member,
containing
a
sorted
</ins><a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">as
value
</del>
</a>
of
<del class="diff-old">active
</del>
<ins class="diff-chg">potential
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator">
property
<ins class="diff-new">generators
</ins></a>,<ins class="diff-new">
and
an
optional
</ins><code><ins class="diff-new">
term
</ins></code><ins class="diff-new">
member
containing
a
</ins><a class="tref internalDFN" title="term" href="#dfn-term"><ins class="diff-new">
term
</ins>
</a>
<ins class="diff-new">to
fall
back
to
</ins>
if
<del class="diff-old">empty
or
</del>
<ins class="diff-chg">none
of
the
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator">
property
<ins class="diff-new">generators
</ins></a><ins class="diff-new">
can
be
applied.
</ins></p><ol class="algorithm"><li><ins class="diff-new">
Initialize
</ins><em><ins class="diff-new">
result
</ins>
</em>
<del class="diff-old">otherwise.
</del>
<ins class="diff-chg">to
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
construct
</del>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">output
</del>
<ins class="diff-chg">level
</ins>
</em>
<del class="diff-old">as
</del>
<ins class="diff-chg">equals
</ins><code><ins class="diff-chg">
3
</ins></code>,<ins class="diff-chg">
i.e.,
the
deepest
nested
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
in
the
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a><ins class="diff-chg">
has
been
reached,
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
inverseContextSubtree
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
propertyGenerators
</ins></code><ins class="diff-chg">
member,
copy
that
member
into
</ins>
a
new
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
<del class="diff-old">used
for
returning
the
result
of
compacting
</del>
<ins class="diff-chg">and
store
that
object
in
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">result
</ins>
</em>.
<del class="diff-old">For
each
</del>
</li>
<li>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">inverseContextSubtree
</ins>
</em>
<ins class="diff-new">has
a
</ins><code><ins class="diff-new">
term
</ins></code><ins class="diff-new">
member
</ins>
and
<em>
<ins class="diff-new">result
</ins></em><ins class="diff-new">
is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a>,<ins class="diff-new">
return
the
</ins>
value
<ins class="diff-new">of
that
member;
otherwise
</ins><em><ins class="diff-new">
result
</ins>
</em>
<del class="diff-old">in
</del>
<ins class="diff-chg">is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>,<ins class="diff-chg">
copy
the
</ins><code><ins class="diff-chg">
term
</ins></code><ins class="diff-chg">
member
into
</ins>
<em>
<del class="diff-old">element:
</del>
<ins class="diff-chg">result
</ins>
</em>
<ins class="diff-chg">and
return
</ins><em><ins class="diff-chg">
result
</ins></em>.</li></ol></li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise,
for
each
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">entry
</ins>
</em>
<del class="diff-old">is
@id
or
</del>
<ins class="diff-chg">of
the
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
queryPath's
</ins></em><em><ins class="diff-chg">
level'd
</ins></em><ins class="diff-chg">
position
(
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">queryPath[level]
</ins>
</code>
<ins class="diff-new">),
perform
the
following
steps:
</ins>
<ol class="algorithm">
<li>
<del class="diff-old">Set
active
property
</del>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
inverseContextSubtree
</ins></em><ins class="diff-chg">
has
no
</ins><em><ins class="diff-chg">
entry
</ins></em><ins class="diff-chg">
member,
continue
with
the
next
</ins><em><ins class="diff-chg">
entry
</ins></em>.</li><li><ins class="diff-chg">
Otherwise
set
</ins><em><ins class="diff-chg">
tmpResult
</ins></em>
to
the
result
of
<del class="diff-old">performing
IRI
Compaction
on
</del>
<ins class="diff-chg">recursively
invoking
this
algorithm
passing
the
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">entry
</ins></em><ins class="diff-chg">
member
of
</ins><em><ins class="diff-chg">
inverseContextSubtree
</ins></em><ins class="diff-chg">
as
new
</ins><em><ins class="diff-chg">
inverseContextSubtree
</ins></em>,<em><ins class="diff-chg">
queryPath
</ins></em>,<ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
level
</ins></em><ins class="diff-chg">
+
</ins><code><ins class="diff-chg">
1
</ins></code><ins class="diff-chg">
as
new
</ins><em><ins class="diff-chg">
level
</ins>
</em>.
</li>
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">tmpResult
</ins>
</em>
is
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
<del class="diff-old">,
the
compacted
</del>
</a>
<ins class="diff-chg">and
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">result
</ins>
</em>
is
<del class="diff-old">the
result
of
performing
IRI
Compaction
on
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,<ins class="diff-chg">
return
</ins>
<em>
<del class="diff-old">value
.
Otherwise,
</del>
<ins class="diff-chg">tmpResult
</ins></em><ins class="diff-chg">
;
otherwise,
if
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">must
</del>
<ins class="diff-chg">is
not
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
transform
</ins><em><ins class="diff-chg">
tmpResult
</ins>
</em>
<del class="diff-old">be
</del>
<ins class="diff-chg">to
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
whose
</ins><code><ins class="diff-chg">
propertyGenerators
</ins></code><ins class="diff-chg">
member
is
set
to
</ins>
an
<ins class="diff-new">empty
</ins>
<a class="tref internalDFN" title="array" href="#dfn-array">
array
<del class="diff-old">.
Perform
IRI
Compaction
</del>
</a>
<del class="diff-old">on
every
entry
of
</del>
<ins class="diff-chg">and
whose
</ins><code><ins class="diff-chg">
term
</ins></code><ins class="diff-chg">
member
is
set
to
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">tmpResult
</ins>
</em>.
</li>
<li>
If
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">contains
just
one
entry
and
</del>
<ins class="diff-chg">is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
replace
it
with
</ins><em><ins class="diff-chg">
tmpResult
</ins></em>.</li><li><ins class="diff-chg">
Otherwise,
append
each
item
of
</ins>
the
<del class="diff-old">compactArrays
</del>
<code>
<ins class="diff-chg">propertyGenerator
</ins>
</code>
<del class="diff-old">option
is
set
</del>
<ins class="diff-chg">member
of
</ins><em><ins class="diff-chg">
tmpResult
</ins></em>
to
<ins class="diff-new">the
</ins>
<code>
<del class="diff-old">true
,
</del>
<ins class="diff-chg">propertyGenerator
</ins></code><ins class="diff-chg">
member
of
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">result
</ins>
</em>
<ins class="diff-new">unless
it
</ins>
is
<del class="diff-old">set
to
that
entry.
</del>
<ins class="diff-chg">already
in
</ins><em><ins class="diff-chg">
result's
</ins></em><ins class="diff-chg">
member.
If
</ins><em><ins class="diff-chg">
result
</ins></em><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
term
</ins></code><ins class="diff-chg">
member
but
</ins><em><ins class="diff-chg">
tmpResult
</ins></em><ins class="diff-chg">
does,
copy
</ins><em><ins class="diff-chg">
tmpResult's
</ins></em><code><ins class="diff-chg">
term
</ins></code><ins class="diff-chg">
member
into
</ins><em><ins class="diff-chg">
result
</ins></em>.</li></ol>
</li>
<li>
<del class="diff-old">Add
</del>
<ins class="diff-chg">Return
</ins><em><ins class="diff-chg">
result
</ins></em>.</li></ol></section><section id="value-compaction"><h3><span class="secno"><ins class="diff-chg">
5.12
</ins></span><ins class="diff-chg">
Value
Compaction
</ins></h3><p><ins class="diff-chg">
Expansion
transforms
all
values
into
</ins><a class="tref internalDFN" title="expanded_form" href="#dfn-expanded_form"><ins class="diff-chg">
expanded
form
</ins></a><ins class="diff-chg">
in
JSON-LD.
This
algorithm
does
the
opposite,
it
compacts
an
algorithm
according
the
</ins><a class="tref internalDFN" title="term_definition" href="#dfn-term_definition"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
of
the
passed
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
<del class="diff-old">and
</del>
</a>.
<ins class="diff-chg">After
</ins>
the
<ins class="diff-new">application
of
this
algorithm
a
value
is
said
to
be
in
</ins><dfn title="compacted_form" id="dfn-compacted_form">
compacted
<ins class="diff-new">form
</ins></dfn>.</p><p><ins class="diff-new">
This
algorithm
takes
a
</ins>
<em>
value
<del class="diff-old">to
</del>
</em>,
<ins class="diff-chg">an
</ins><a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
an
</ins><a class="tref internalDFN" title="inverse_context" href="#dfn-inverse_context"><ins class="diff-chg">
inverse
context
</ins></a>,<ins class="diff-chg">
an
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
and
an
optional
</ins>
<em>
<del class="diff-old">output
</del>
<ins class="diff-chg">containerValue
</ins>
</em>.
</p>
<ol class="algorithm">
<li>
<del class="diff-old">Otherwise,
</del>
<ins class="diff-chg">If
a
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">containerValue
</ins>
</em>
<del class="diff-old">must
</del>
<ins class="diff-chg">has
been
passed,
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
has
a
</ins><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
set
to
</ins><code><ins class="diff-chg">
@annotation
</ins></code><ins class="diff-chg">
and
</ins><em><ins class="diff-chg">
value
</ins>
</em>
<del class="diff-old">be
</del>
<ins class="diff-chg">has
</ins>
an
<del class="diff-old">array
.
</del>
<code>
<ins class="diff-chg">@annotation
</ins></code><ins class="diff-chg">
member
which
equals
</ins><em><ins class="diff-chg">
containerValue
</ins></em>,<ins class="diff-chg">
remove
that
member.
</ins>
</li>
<li>
If
<em>
value
</em>
is
<del class="diff-old">empty:
Set
active
property
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins>
</a>
<del class="diff-old">to
</del>
<ins class="diff-chg">having
a
single
member
</ins><code><ins class="diff-chg">
@id
</ins></code>,<ins class="diff-chg">
return
</ins>
the
result
of
performing
<a href="#iri-compaction-algorithm">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
</a>
on
<del class="diff-old">property
.
</del>
<ins class="diff-chg">that
member's
value.
</ins>
</li>
<li>
<del class="diff-old">Create
an
entry
in
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
<em>
<del class="diff-old">output
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">for
</del>
<ins class="diff-chg">is
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
having
a
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member,
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
the
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
<ins class="diff-new">has
a
</ins><a class="tref internalDFN" title="type_mapping" href="#dfn-type_mapping"><ins class="diff-new">
type
mapping
</ins></a>
and
<em>
value
<del class="diff-old">.
For
each
item
</del>
</em>
<del class="diff-old">in
</del>
<ins class="diff-chg">has
a
corresponding
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member,
remove
the
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
from
</ins>
<em>
value
<del class="diff-old">:
</del>
</em>.
</li>
<li>
<del class="diff-old">Set
</del>
<ins class="diff-chg">Otherwise,
if
the
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
<del class="diff-old">to
the
result
of
performing
IRI
Compaction
</del>
<ins class="diff-chg">has
a
</ins><a class="tref internalDFN" title="language_mapping" href="#dfn-language_mapping"><ins class="diff-chg">
language
mapping
</ins>
</a>
<del class="diff-old">for
property
</del>
and
<em>
<del class="diff-old">item
using
the
active
context
.
Compact
item
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">by
recursively
performing
this
algorithm
passing
</del>
<ins class="diff-chg">has
</ins>
a
<del class="diff-old">copy
of
the
active
context
and
</del>
<ins class="diff-chg">corresponding
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
member,
remove
</ins>
the
<del class="diff-old">active
property
.
</del>
<code>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
member
from
</ins><em><ins class="diff-chg">
value
</ins></em>.
</li>
<li>
<del class="diff-old">If
an
entry
already
exists
in
</del>
<ins class="diff-chg">Otherwise,
if
a
</ins>
<em>
<del class="diff-old">output
</del>
<ins class="diff-chg">containerValue
</ins>
</em>
<del class="diff-old">for
</del>
<ins class="diff-chg">has
been
passed,
the
</ins>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
<del class="diff-old">,
convert
it
to
an
array
</del>
</a>
<del class="diff-old">if
necessary,
</del>
<ins class="diff-chg">has
a
</ins><a class="tref internalDFN" title="container_mapping" href="#dfn-container_mapping"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
set
to
</ins><code><ins class="diff-chg">
@language
</ins></code>,
and
<del class="diff-old">append
</del>
<em>
<ins class="diff-chg">value
</ins></em><ins class="diff-chg">
has
a
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
member
which
equals
</ins><em><ins class="diff-chg">
containerValue
</ins></em>,<ins class="diff-chg">
remove
</ins>
the
<del class="diff-old">compacted
</del>
<code>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
member
from
</ins>
<em>
value
</em>.
</li>
<li>
Otherwise,
if
the
<del class="diff-old">compacted
</del>
<a class="tref internalDFN" title="active_context" href="#dfn-active_context">
<ins class="diff-chg">active
context
</ins></a><ins class="diff-chg">
has
a
</ins><a class="tref internalDFN" title="default_language" href="#dfn-default_language"><ins class="diff-chg">
default
language
</ins></a><ol class="algorithm"><li><ins class="diff-chg">
and
the
</ins>
<em>
value
</em>
<del class="diff-old">is
not
an
array
and
active
property
</del>
has
a
<ins class="diff-new">corresponding
</ins>
<code>
<del class="diff-old">@container
mapping
to
@set
</del>
<ins class="diff-chg">@language
</ins>
</code>
<del class="diff-old">or
if
</del>
<ins class="diff-chg">member,
remove
</ins>
the
<del class="diff-old">compactArrays
option
is
set
to
</del>
<code>
<del class="diff-old">false
,
convert
</del>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
member
from
</ins>
<em>
value
<del class="diff-old">to
an
array.
</del>
</em>.
</li>
<li>
<del class="diff-old">Create
an
entry
in
</del>
<ins class="diff-chg">Otherwise,
or
if
the
value
of
</ins>
<em>
<del class="diff-old">output
</del>
<ins class="diff-chg">value's
</ins>
</em>
<del class="diff-old">for
active
property
and
</del>
<code>
<ins class="diff-chg">@value
</ins></code><ins class="diff-chg">
member
is
a
</ins><a class="tref internalDFN" title="string" href="#dfn-string"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
return
</ins>
<em>
value
</em>.
</li>
</ol>
</li>
<li>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
has
just
a
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member,
return
the
value
of
that
member.
</ins>
</li>
</ol>
</li>
<li>
<del class="diff-old">Otherwise,
return
</del>
<ins class="diff-chg">Return
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">value
</ins>
</em>
as
<del class="diff-old">the
compacted
element
.
</del>
<ins class="diff-chg">is.
</ins></li></ol></section><section id="find-and-remove-property-generator-duplicates"><h3>
<del class="diff-old">Issue
</del>
<span class="secno">
<ins class="diff-chg">5.13
</ins>
</span>
<del class="diff-old">Perhaps
this
should
also
call
Value
Compaction
on
native
types
</del>
<ins class="diff-chg">Find
</ins>
and
<del class="diff-old">strings,
which
could
consolidate
potential
transformation
in
one
place.
</del>
<ins class="diff-chg">Remove
Property
Generator
Duplicates
</ins></h3>
<p>
<del class="diff-old">If,
after
the
</del>
<ins class="diff-chg">This
</ins>
algorithm
<del class="diff-old">outlined
above
is
run,
the
resulting
</del>
<ins class="diff-chg">checks
if
a
specific
value
exists
for
all
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><ins class="diff-chg">
IRIs
</ins></a><ins class="diff-chg">
associated
with
a
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator"><ins class="diff-chg">
property
generator
</ins></a><ins class="diff-chg">
and
if
so,
it
removes
them.
The
algorithm
takes
five
parameters:
</ins>
<em>
element
<del class="diff-old">is
an
array
</del>
</em>,
<em>
<ins class="diff-chg">property
</ins></em>,<em><ins class="diff-chg">
value
</ins></em>,<a class="tref internalDFN" title="active_context" href="#dfn-active_context"><ins class="diff-chg">
active
context
</ins>
</a>,
<del class="diff-old">put
</del>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-chg">active
property
</ins></a>.</p><ol class="algorithm"><li><ins class="diff-chg">
For
each
item
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">propertyGenerator
</ins>
</em>
<del class="diff-old">into
</del>
<ins class="diff-chg">of
the
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
which
is
the
value
of
</ins>
the
<code>
<del class="diff-old">@graph
</del>
<ins class="diff-chg">propertyGenerators
</ins>
</code>
<del class="diff-old">property
</del>
<ins class="diff-chg">member
</ins>
of
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-new">active
property
</ins></a><ins class="diff-new">
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-new">
Check
that
</ins>
a
<del class="diff-old">new
JSON
object
</del>
<ins class="diff-chg">member
exists
for
each
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>
<del class="diff-old">and
then
set
</del>
<ins class="diff-chg">associated
with
the
</ins>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">propertyGenerator
</ins></em>.<ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
value
</ins>
</em>
<del class="diff-old">to
</del>
<ins class="diff-chg">is
not
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
also
check
whether
each
of
those
members
</ins>
that
<del class="diff-old">JSON
object
.
Finally,
add
a
@context
property
to
</del>
<ins class="diff-chg">contains
</ins>
<em>
<del class="diff-old">element
and
set
it
</del>
<ins class="diff-chg">value
</ins></em>.<ins class="diff-chg">
Values
are
considered
</ins>
to
<ins class="diff-new">be
equal
if
they
are
of
</ins>
the
<del class="diff-old">initially
passed
context
.
4.9
Flattening
Flattening
is
</del>
<ins class="diff-chg">same
type
and
have
</ins>
the
<del class="diff-old">process
of
taking
a
JSON-LD
document,
expanding
</del>
<ins class="diff-chg">same
value(s);
</ins><a class="tref internalDFN" title="node_object" href="#dfn-node_object"><ins class="diff-chg">
node
objects
</ins>
</a>
<del class="diff-old">it,
labeling
</del>
<ins class="diff-chg">are
considered
to
be
equal
if
</ins>
all
<ins class="diff-new">members
match,
except
if
no
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
member
exists
(i.e.,
it
is
an
</ins>
unlabeled
<del class="diff-old">nodes
with
a
</del>
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>,
<ins class="diff-new">in
that
case
</ins><a class="tref internalDFN" title="node_object" href="#dfn-node_object"><ins class="diff-new">
node
objects
</ins>
</a>
<del class="diff-old">identifier,
and
returning
an
array
of
</del>
<ins class="diff-chg">are
never
considered
to
be
equal.
</ins></li><li><ins class="diff-chg">
If
that's
not
</ins>
the
<del class="diff-old">nodes
defined
in
</del>
<ins class="diff-chg">case,
continue
with
</ins>
the
<del class="diff-old">document.
For
example,
assume
</del>
<ins class="diff-chg">next
</ins><em><ins class="diff-chg">
propertyGenerator
</ins></em>.</li><li><ins class="diff-chg">
Otherwise,
remove
</ins><em><ins class="diff-chg">
value
</ins></em><ins class="diff-chg">
from
every
member.
If
</ins>
the
<del class="diff-old">following
JSON-LD
input
document:
{
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;knows&quot;: &quot;http://xmlns.com/foaf/0.1/knows&quot;
  },
  &quot;@id&quot;: &quot;http://example.com/markus&quot;,
  &quot;name&quot;: &quot;Markus Lanthaler&quot;,
  &quot;knows&quot;: {
    &quot;name&quot;: &quot;Manu Sporny&quot;
  }
}
Running
</del>
<ins class="diff-chg">resulting
value
of
a
member
is
an
empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
remove
</ins>
the
<del class="diff-old">JSON-LD
Flattening
algorithm
for
</del>
<ins class="diff-chg">member
altogether
from
</ins><em><ins class="diff-chg">
element
</ins></em>.</li><li><ins class="diff-chg">
Return
</ins><em><ins class="diff-chg">
propertyGenerator
</ins></em>.</li></ol></li><li><ins class="diff-chg">
Return
the
value
of
</ins>
the
<del class="diff-old">merged
graph
(
</del>
<code>
<del class="diff-old">@merged
</del>
<ins class="diff-chg">term
</ins>
</code>
<del class="diff-old">)
against
the
JSON-LD
input
document
provided
above
would
result
in
the
following
output:
[
  {
    &quot;@id&quot;: &quot;http://example.com/markus&quot;,
    &quot;http://xmlns.com/foaf/0.1/knows&quot;: [ { &quot;@id&quot;: &quot;_:t0&quot; } ],
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [ { &quot;@value&quot;: &quot;Markus Lanthaler&quot; } ]
  },
  {
    &quot;@id&quot;: &quot;_:t0&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [ { &quot;@value&quot;: &quot;Manu Sporny&quot; } ]
  }
]
</del>
<ins class="diff-chg">member
of
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
since
no
matching
</ins><a class="tref internalDFN" title="property_generator" href="#dfn-property_generator"><ins class="diff-chg">
property
generator
</ins></a><ins class="diff-chg">
has
been
found.
</ins></li></ol></section>
<section id="flattening-algorithm">
<h3>
<span class="secno">
<del class="diff-old">4.9.1
</del>
<ins class="diff-chg">5.14
</ins>
</span>
Flattening
Algorithm
</h3>
<p>
The
algorithm
takes
two
input
variables,
an
<em>
element
</em>
to
flatten
and
<del class="diff-old">the
graph
for
which
the
node
definitions
should
be
returned.
If
</del>
<ins class="diff-chg">a
</ins>
<em>
<del class="diff-old">graph
</del>
<ins class="diff-chg">context
</ins>
</em>
<del class="diff-old">is
not
set,
it
will
default
</del>
<ins class="diff-chg">used
</ins>
to
<del class="diff-old">@merged
which
represents
the
result
of
merging
all
graphs
including
</del>
<ins class="diff-chg">compact
</ins>
the
<del class="diff-old">default
graph
(
@default
).
</del>
<ins class="diff-chg">flattened
document.
</ins>
</p>
<ol class="algorithm">
<li>
Expand
<em>
element
</em>
according
the
<a href="#expansion-algorithm">
Expansion
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins>
</a>.
</li>
<li>
Generate
a
<em>
nodeMap
</em>
according
the
<a href="#node-map-generation">
Node
Map
Generation
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins>
</a>.
</li>
<li>
<del class="diff-old">Initialize
</del>
<ins class="diff-chg">Let
</ins><em><ins class="diff-chg">
defaultGraph
</ins></em><ins class="diff-chg">
be
the
value
of
the
</ins><code><ins class="diff-chg">
@default
</ins></code><ins class="diff-chg">
member
of
</ins><em><ins class="diff-chg">
nodeMap
</ins></em><ins class="diff-chg">
;
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
representing
the
</ins><a class="tref internalDFN" title="default_graph" href="#dfn-default_graph"><ins class="diff-chg">
default
graph
</ins></a>.</li><li><ins class="diff-chg">
For
each
other
</ins><em><ins class="diff-chg">
graphName
</ins></em><ins class="diff-chg">
-
</ins><em><ins class="diff-chg">
graph
</ins></em><ins class="diff-chg">
pair
in
</ins><em><ins class="diff-chg">
nodeMap
</ins></em><ins class="diff-chg">
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
defaultGraph
</ins></em><ins class="diff-chg">
does
not
have
a
</ins><em><ins class="diff-chg">
graphName
</ins></em><ins class="diff-chg">
member,
create
one
and
initialize
its
value
to
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
consisting
of
an
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member
whose
value
is
set
to
</ins><em><ins class="diff-chg">
graphName
</ins></em>.</li><li><ins class="diff-chg">
Add
a
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
member
set
to
</ins>
an
empty
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
<ins class="diff-new">(referred
to
as
</ins>
<em>
<del class="diff-old">result
</del>
<ins class="diff-chg">nodes
</ins></em><ins class="diff-chg">
)
to
the
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
which
is
the
value
of
the
</ins><em><ins class="diff-chg">
graphName
</ins></em><ins class="diff-chg">
member
of
</ins><em><ins class="diff-chg">
nodeMap
</ins>
</em>.
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">For
each
</ins>
<em>
<del class="diff-old">nodeMap
</del>
<ins class="diff-chg">id
</ins>
</em>
<del class="diff-old">has
no
property
</del>
<ins class="diff-chg">-
</ins><em><ins class="diff-chg">
node
</ins></em><ins class="diff-chg">
pair
in
</ins>
<em>
graph
<del class="diff-old">,
return
</del>
</em>
<ins class="diff-chg">ordered
by
</ins>
<em>
<del class="diff-old">result
</del>
<ins class="diff-chg">id
</ins>
</em>,
<del class="diff-old">otherwise
set
</del>
<ins class="diff-chg">add
</ins>
<em>
<del class="diff-old">definitions
</del>
<ins class="diff-chg">node
</ins>
</em>
to
<del class="diff-old">its
value.
</del>
<ins class="diff-chg">the
</ins><em><ins class="diff-chg">
nodes
</ins></em><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.</li></ol>
</li>
<li>
<del class="diff-old">Foreach
</del>
<ins class="diff-chg">Initialize
an
empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
flattened.
</ins></li><li><ins class="diff-chg">
For
each
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">id
</ins>
</em>
<del class="diff-old">and
</del>
<ins class="diff-chg">-
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">node
</ins>
</em>
<del class="diff-old">of
of
</del>
<ins class="diff-chg">pair
in
</ins>
<em>
<del class="diff-old">definitions
</del>
<ins class="diff-chg">defaultGraph
</ins>
</em>
ordered
by
<em>
<del class="diff-old">property
:
Add
</del>
<ins class="diff-chg">id
</ins></em>,<ins class="diff-chg">
add
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">node
</ins>
</em>
to
<em>
<del class="diff-old">result
</del>
<ins class="diff-chg">flattened
</ins>
</em>.
</li>
<li>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
context
</ins></em><ins class="diff-chg">
equals
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
return
</ins><em><ins class="diff-chg">
flattened
</ins></em>.
</li>
<li>
<del class="diff-old">Return
</del>
<ins class="diff-chg">Otherwise,
return
the
result
of
compacting
</ins><em><ins class="diff-chg">
flattened
</ins></em><ins class="diff-chg">
according
the
</ins><a href="#compaction-algorithm"><ins class="diff-chg">
Compaction
algorithm
</ins></a><ins class="diff-chg">
passing
</ins>
<em>
<ins class="diff-new">context
</ins></em><ins class="diff-new">
ensuring
that
the
compaction
</ins>
result
<del class="diff-old">.
</del>
<ins class="diff-chg">uses
the
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
keyword
(or
its
alias)
at
the
top-level,
even
if
the
context
is
empty
or
if
there
is
only
one
element
to
put
in
the
</ins><code><ins class="diff-chg">
@graph
</ins></code><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.<ins class="diff-chg">
This
ensures
that
the
returned
document
has
a
deterministic
structure.
</ins>
</li>
</ol>
</section>
<section id="node-map-generation">
<h3>
<span class="secno">
<del class="diff-old">4.9.2
</del>
<ins class="diff-chg">5.15
</ins>
</span>
Node
Map
Generation
</h3>
<p>
<del class="diff-old">The
Node
Map
Generation
</del>
<ins class="diff-chg">This
</ins>
algorithm
<del class="diff-old">takes
as
input
an
expanded
JSON-LD
document
and
results
in
</del>
<ins class="diff-chg">creates
</ins>
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
<em>
nodeMap
</em>
holding
<del class="diff-old">a
flat
</del>
<ins class="diff-chg">an
indexed
</ins>
representation
of
the
<a class="tref internalDFN" title="json-ld_graph" href="#dfn-json-ld_graph">
graphs
</a>
and
<a class="tref internalDFN" title="node" href="#dfn-node">
nodes
</a>
represented
in
the
<ins class="diff-new">passed,
expanded
</ins>
document.
All
<a class="tref internalDFN" title="node" href="#dfn-node">
nodes
</a>
that
are
not
uniquely
identified
by
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
get
assigned
a
(new)
<a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier">
blank
node
<del class="diff-old">identifier.
</del>
<ins class="diff-chg">identifier
</ins></a>.
The
resulting
<em>
nodeMap
</em>
<del class="diff-old">document
</del>
will
have
a
<del class="diff-old">property
</del>
<ins class="diff-chg">member
</ins>
for
every
graph
in
the
document
whose
value
is
another
object
with
a
<del class="diff-old">property
</del>
<ins class="diff-chg">member
</ins>
for
every
<a class="tref internalDFN" title="node" href="#dfn-node">
node
</a>
represented
in
the
document.
<del class="diff-old">While
the
</del>
<ins class="diff-chg">The
</ins>
default
graph
is
stored
under
the
<code>
@default
</code>
<del class="diff-old">property
and
the
merged
graph
under
the
@merged
property,
</del>
<ins class="diff-chg">member,
</ins>
all
other
graphs
are
stored
under
their
<del class="diff-old">respective
IRIs
.
</del>
<ins class="diff-chg">graph
name.
</ins>
</p>
<p>
The
algorithm
takes
as
input
<del class="diff-old">the
</del>
<ins class="diff-chg">an
</ins>
expanded
JSON-LD
document
<del class="diff-old">as
</del>
<em>
element
<del class="diff-old">,
the
initially
empty
</del>
</em>
<ins class="diff-chg">and
a
reference
to
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>
<em>
nodeMap
<del class="diff-old">,
</del>
</em>.
<ins class="diff-chg">Furthermore
it
has
the
optional
parameters
</ins><a class="tref internalDFN" title="active_graph" href="#dfn-active_graph"><ins class="diff-chg">
active
graph
</ins></a><ins class="diff-chg">
(which
defaults
to
</ins>
<code>
@default
</code>
<del class="diff-old">as
graph
,
null
as
list
,
</del>
<ins class="diff-chg">),
an
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins></a>,<a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>,
and
<del class="diff-old">null
</del>
<ins class="diff-chg">a
reference
to
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins>
</a>
<del class="diff-old">as
</del>
<em>
<del class="diff-old">id
</del>
<ins class="diff-chg">list
</ins>
</em>.
<ins class="diff-new">The
</ins><em><ins class="diff-new">
nodeMap
</ins></em><ins class="diff-new">
must
be
initialized
to
a
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
consisting
of
a
single
member
whose
name
corresponds
with
</ins><a class="tref internalDFN" title="active_graph" href="#dfn-active_graph"><ins class="diff-new">
active
graph
</ins></a><ins class="diff-new">
and
whose
value
is
an
empty
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a>.
</p>
<ol class="algorithm">
<li>
If
<em>
element
</em>
is
an
array,
process
each
entry
in
<em>
element
</em>
recursively,
using
this
algorithm
and
return.
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise
</ins>
<em>
element
</em>
is
<del class="diff-old">not
</del>
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
<del class="diff-old">or
if
it
has
a
@value
property,
then
if
</del>
</a>.
<ins class="diff-chg">Let
</ins>
<em>
<del class="diff-old">list
</del>
<ins class="diff-chg">activeGraph
</ins>
</em>
<ins class="diff-new">be
the
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
which
</ins>
is
<del class="diff-old">not
null
,
append
element
to
</del>
<ins class="diff-chg">the
value
of
the
</ins><a class="tref internalDFN" title="active_graph" href="#dfn-active_graph"><ins class="diff-chg">
active
graph
</ins></a><ins class="diff-chg">
member
of
</ins>
<em>
<del class="diff-old">list
and
return.
</del>
<ins class="diff-chg">nodeMap
</ins></em>.
</li>
<li>
If
<del class="diff-old">id
is
null
and
if
the
</del>
<ins class="diff-chg">it
has
a
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">property
exists
and
is
an
IRI
,
set
</del>
<ins class="diff-chg">member,
perform
for
each
</ins>
<em>
<del class="diff-old">id
</del>
<ins class="diff-chg">item
</ins>
</em>
<del class="diff-old">to
its
value,
otherwise
set
it
to
a
blank
node
identifier
created
by
</del>
the
<del class="diff-old">Generate
Blank
Node
Identifier
algorithm.
</del>
<ins class="diff-chg">following
steps:
</ins><ol class="algorithm">
<li>
If
<em>
<del class="diff-old">list
</del>
<ins class="diff-chg">item
</ins>
</em>
is
<del class="diff-old">not
null
</del>
<ins class="diff-chg">a
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifier
</ins>
</a>,
<del class="diff-old">append
</del>
<ins class="diff-chg">replace
it
with
</ins>
a
<a href="#generate-blank-node-identifier">
new
<ins class="diff-chg">blank
</ins>
node
<del class="diff-old">reference
to
list
using
id
as
the
value
for
@id
.
</del>
<ins class="diff-chg">identifier
</ins></a>.
</li>
<li>
<del class="diff-old">Let
nodes
be
the
value
in
nodeMap
where
the
key
is
</del>
<ins class="diff-chg">If
</ins>
<em>
<del class="diff-old">graph
</del>
<ins class="diff-chg">activeGraph
</ins>
</em>
<del class="diff-old">;
if
</del>
<ins class="diff-chg">has
</ins>
no
<del class="diff-old">such
</del>
<ins class="diff-chg">member
</ins><em><ins class="diff-chg">
item
</ins></em>,<ins class="diff-chg">
create
it
and
initialize
its
</ins>
value
<del class="diff-old">exists,
insert
</del>
<ins class="diff-chg">to
</ins>
a
<del class="diff-old">new
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
<del class="diff-old">for
</del>
<ins class="diff-chg">consisting
of
a
single
member
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
with
</ins>
the
<del class="diff-old">key
</del>
<ins class="diff-chg">value
</ins>
<em>
<del class="diff-old">graph
</del>
<ins class="diff-chg">item
</ins>
</em>.
</li>
</ol>
</li>
<li>
If
<em>
<del class="diff-old">id
</del>
<ins class="diff-chg">element
</ins>
</em>
<ins class="diff-new">has
an
</ins><code><ins class="diff-new">
@value
</ins></code><ins class="diff-new">
member,
perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-new">
If
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-new">
active
property
</ins></a>
is
<del class="diff-old">not
in
nodes
,
create
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins></a>,<a href="#generate-blank-node-identifier"><ins class="diff-chg">
generate
</ins>
a
<del class="diff-old">new
JSON
object
</del>
<ins class="diff-chg">blank
</ins>
node
<del class="diff-old">with
</del>
<ins class="diff-chg">identifier
</ins></a>
<em>
id
</em>
<del class="diff-old">as
the
value
for
@id
.
Let
</del>
<ins class="diff-chg">and
store
</ins>
<em>
<del class="diff-old">node
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">be
the
</del>
<ins class="diff-chg">as
</ins>
value
of
<ins class="diff-new">the
member
</ins>
<em>
id
</em>
in
<em>
<del class="diff-old">nodes
</del>
<ins class="diff-chg">activeGraph
</ins>
</em>.
<div class="issue">
<div class="issue-title">
<a href="https://github.com/json-ld/json-ld.org/issues/207">
<span>
<ins class="diff-new">Issue
207
</ins></span></a></div><p class=""><ins class="diff-new">
Handling
of
free-floating
values
is
still
being
discussed.
</ins></p></div>
</li>
<li>
<del class="diff-old">For
each
property
that
is
not
@id
and
each
</del>
<ins class="diff-chg">Otherwise,
if
no
</ins>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">list
</ins>
</em>
<del class="diff-old">in
</del>
<ins class="diff-chg">has
been
passed,
merge
</ins>
<em>
element
</em>
<del class="diff-old">ordered
by
</del>
<ins class="diff-chg">into
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
</ins>
property
<del class="diff-old">:
</del>
</a>
<ins class="diff-chg">member
of
the
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins></a><ins class="diff-chg">
in
</ins><em><ins class="diff-chg">
activeGraph
</ins></em>.</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise,
append
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">to
the
</ins>
<code>
<del class="diff-old">@graph
,
recursively
call
this
algorithm
passing
value
for
element
,
nodeMap
,
null
for
</del>
<ins class="diff-chg">@list
</ins></code><ins class="diff-chg">
member
of
</ins>
<em>
list
<del class="diff-old">and
</del>
</em>.
</li>
</ol>
</li>
<li>
<ins class="diff-chg">Otherwise,
</ins>
if
<em>
<del class="diff-old">graph
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">is
</del>
<ins class="diff-chg">has
an
</ins>
<code>
<del class="diff-old">@merged
</del>
<ins class="diff-chg">@list
</ins>
</code>
<del class="diff-old">use
graph
,
otherwise
use
id
for
graph
and
then
continue.
</del>
<ins class="diff-chg">member,
perform
the
following
steps:
</ins><ol class="algorithm">
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Initialize
a
new
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-chg">
JSON
object
</ins></a>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">is
not
@type
and
is
</del>
<ins class="diff-chg">having
</ins>
a
<del class="diff-old">keyword,
merge
</del>
<ins class="diff-chg">single
member
</ins>
<code>
<del class="diff-old">property
</del>
<ins class="diff-chg">@list
</ins>
</code>
<del class="diff-old">and
</del>
<ins class="diff-chg">whose
</ins>
value
<del class="diff-old">into
node
and
then
continue.
</del>
<ins class="diff-chg">is
initialized
to
an
empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.
</li>
<li>
<del class="diff-old">For
each
</del>
<ins class="diff-chg">Recursively
call
this
algorithm
passing
the
</ins>
value
<ins class="diff-new">of
</ins>
<em>
<del class="diff-old">v
</del>
<ins class="diff-chg">element's
</ins>
</em>
<del class="diff-old">in
the
array
</del>
<code>
<ins class="diff-chg">@list
</ins></code><ins class="diff-chg">
member
as
new
</ins>
<em>
<del class="diff-old">value
:
If
</del>
<ins class="diff-chg">element
</ins></em><ins class="diff-chg">
and
</ins>
<em>
<del class="diff-old">v
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">is
a
node
definition
or
node
reference
:
</del>
<ins class="diff-chg">as
</ins><em><ins class="diff-chg">
list
</ins></em>.</li>
<li>
If
<del class="diff-old">the
</del>
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
<ins class="diff-chg">active
</ins>
property
<del class="diff-old">@id
is
not
an
IRI
</del>
</a>
<del class="diff-old">or
it
does
not
exist,
map
v
to
a
</del>
<ins class="diff-chg">is
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-chg">
null
</ins></a>,
<a href="#generate-blank-node-identifier">
<del class="diff-old">new
</del>
<ins class="diff-chg">generate
a
</ins>
blank
node
identifier
</a>
<em>
<del class="diff-old">name
</del>
<ins class="diff-chg">id
</ins>
</em>
<del class="diff-old">to
avoid
collisions.
If
one
does
not
already
exist,
add
a
node
reference
for
</del>
<ins class="diff-chg">and
store
</ins>
<em>
<del class="diff-old">v
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">into
</del>
<ins class="diff-chg">as
value
of
the
member
</ins>
<em>
<del class="diff-old">node
</del>
<ins class="diff-chg">id
</ins>
</em>
<del class="diff-old">for
</del>
<ins class="diff-chg">in
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">activeGraph
</ins>
</em>.
<div class="issue">
<div class="issue-title">
<a href="https://github.com/json-ld/json-ld.org/issues/207">
<span>
<ins class="diff-new">Issue
207
</ins></span></a></div><p class=""><ins class="diff-new">
Handling
of
free-floating
values
is
still
being
discussed.
</ins></p></div>
</li>
<li>
<del class="diff-old">Recursively
call
this
algorithm
passing
</del>
<ins class="diff-chg">Otherwise,
add
</ins>
<em>
<del class="diff-old">v
</del>
<ins class="diff-chg">result
</ins>
</em>
<del class="diff-old">for
</del>
<ins class="diff-chg">to
the
the
</ins>
value
<del class="diff-old">,
nodeMap
,
graph
,
null
</del>
<ins class="diff-chg">of
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins>
</a>
<del class="diff-old">for
list
,
and
name
for
</del>
<ins class="diff-chg">member
of
the
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins></a><ins class="diff-chg">
in
</ins>
<em>
<del class="diff-old">id
</del>
<ins class="diff-chg">activeGraph
</ins>
</em>.
</li>
</ol>
</li>
<li>
Otherwise
<del class="diff-old">if
</del>
<em>
<del class="diff-old">v
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">has
</del>
<ins class="diff-chg">is
a
</ins><a class="tref internalDFN" title="node_object" href="#dfn-node_object"><ins class="diff-chg">
node
object
</ins></a>,<ins class="diff-chg">
perform
</ins>
the
<del class="diff-old">property
</del>
<ins class="diff-chg">following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
an
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@id
</ins>
</code>
<del class="diff-old">then
recursively
call
this
algorithm
with
the
</del>
<ins class="diff-chg">member,
store
its
</ins>
value
<del class="diff-old">of
@list
as
</del>
<ins class="diff-chg">in
</ins>
<em>
<del class="diff-old">element
,
</del>
<ins class="diff-chg">id
</ins></em><ins class="diff-chg">
and
remove
the
member
from
</ins>
<em>
<del class="diff-old">nodeMap
,
</del>
<ins class="diff-chg">element
</ins></em>.<ins class="diff-chg">
If
</ins>
<em>
<del class="diff-old">graph
,
and
</del>
<ins class="diff-chg">id
</ins></em><ins class="diff-chg">
is
a
</ins><a class="tref internalDFN" title="blank_node_identifier" href="#dfn-blank_node_identifier"><ins class="diff-chg">
blank
node
identifier
</ins></a>,<ins class="diff-chg">
replace
it
with
</ins><a href="#generate-blank-node-identifier">
a
new
<del class="diff-old">array
flattenedList
</del>
<ins class="diff-chg">blank
node
identifier
</ins></a>.</li><li><ins class="diff-chg">
Otherwise
</ins><a href="#generate-blank-node-identifier"><ins class="diff-chg">
generate
a
new
blank
node
identifier
</ins></a><ins class="diff-chg">
and
store
it
</ins>
as
<em>
<del class="diff-old">list
</del>
<ins class="diff-chg">id
</ins>
</em>.
<del class="diff-old">Create
</del>
</li>
<li>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
activeGraph
</ins></em><ins class="diff-chg">
does
not
contain
a
member
</ins><em><ins class="diff-chg">
id
</ins></em>,<ins class="diff-chg">
create
one
and
initialize
it
to
</ins>
a
<del class="diff-old">new
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
<del class="diff-old">with
the
property
</del>
<ins class="diff-chg">consisting
of
a
single
member
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@id
</ins>
</code>
<ins class="diff-new">whose
value
is
</ins>
set
to
<em>
<del class="diff-old">flattenedList
and
add
it
to
node
for
property
</del>
<ins class="diff-chg">id
</ins>
</em>.
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">If
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
</ins>
property
<del class="diff-old">is
@type
and
v
</del>
</a>
is
not
<del class="diff-old">an
IRI
</del>
<a class="tref internalDFN" title="null" href="#dfn-null">
<ins class="diff-chg">null
</ins>
</a>,
<del class="diff-old">generate
</del>
<ins class="diff-chg">perform
the
following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Create
</ins>
a
new
<del class="diff-old">blank
node
identifier
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins>
</a>
<del class="diff-old">and
add
it
to
</del>
<em>
<del class="diff-old">node
</del>
<ins class="diff-chg">reference
</ins>
</em>
<del class="diff-old">for
</del>
<ins class="diff-chg">consisting
of
a
single
member
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
whose
value
is
</ins>
<em>
<del class="diff-old">property
</del>
<ins class="diff-chg">id
</ins>
</em>.
</li>
<li>
<del class="diff-old">Otherwise,
add
</del>
<ins class="diff-chg">If
no
</ins>
<em>
<del class="diff-old">v
</del>
<ins class="diff-chg">list
</ins>
</em>
<del class="diff-old">to
</del>
<ins class="diff-chg">has
been
passed,
merge
</ins>
<em>
<del class="diff-old">node
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">for
</del>
<ins class="diff-chg">into
the
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
</ins>
property
</a>
<ins class="diff-new">member
of
the
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-new">
active
subject
</ins></a><ins class="diff-new">
in
</ins><em><ins class="diff-new">
activeGraph
</ins>
</em>.
</li>
<li>
<ins class="diff-chg">Otherwise,
append
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
to
the
</ins><code><ins class="diff-chg">
@list
</ins></code><ins class="diff-chg">
member
of
</ins><em><ins class="diff-chg">
list
</ins></em>.
</li>
</ol>
</li>
<del class="diff-old">After
the
above
outlined
algorithm
</del>
<li>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
element
</ins></em>
has
<del class="diff-old">been
executed,
the
node
map
for
all
graphs
including
</del>
<ins class="diff-chg">an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member,
merge
each
value
into
</ins>
the
<del class="diff-old">default
graph
are
contained
</del>
<code>
<ins class="diff-chg">@type
</ins></code><ins class="diff-chg">
of
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins></a>
in
<em>
<del class="diff-old">nodeMap
</del>
<ins class="diff-chg">activeGraph
</ins>
</em>.
<del class="diff-old">To
also
create
the
node
map
for
the
merged
graph,
execute
</del>
<ins class="diff-chg">Then
remove
</ins>
the
<del class="diff-old">algorithm
again,
but
pass
</del>
<code>
<del class="diff-old">@merged
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">for
</del>
<ins class="diff-chg">member
from
</ins>
<em>
<del class="diff-old">graph
</del>
<ins class="diff-chg">element
</ins>
</em>.
<del class="diff-old">4.9.3
Generate
Blank
Node
Identifier
This
algorithm
is
used
by
</del>
</li>
<li>
<ins class="diff-chg">If
</ins><em><ins class="diff-chg">
element
</ins></em><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@annotation
</ins></code><ins class="diff-chg">
member,
set
</ins>
the
<del class="diff-old">Node
Map
Generation
Algorithm
</del>
<code>
<ins class="diff-chg">@annotation
</ins></code><ins class="diff-chg">
of
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins>
</a>
<ins class="diff-new">in
</ins><em><ins class="diff-new">
activeGraph
</ins></em>
to
<del class="diff-old">deterministically
name
blank
node
</del>
<ins class="diff-chg">its
value.
If
such
a
member
already
exists
in
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins>
</a>
<del class="diff-old">identifiers.
It
uses
</del>
<ins class="diff-chg">and
has
a
different
value,
raise
</ins>
a
<code class="error">
<ins class="diff-new">CONFLICTING_ANNOTATION
</ins></code><ins class="diff-new">
error.
Otherwise
continue
and
remove
the
</ins><code><ins class="diff-new">
@annotation
</ins></code><ins class="diff-new">
from
</ins>
<em>
<del class="diff-old">identifier
map
</del>
<ins class="diff-chg">element
</ins></em>.</li><li><ins class="diff-chg">
If
</ins><em><ins class="diff-chg">
element
</ins>
</em>
<del class="diff-old">and
</del>
<ins class="diff-chg">has
an
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
member,
recursively
invoke
this
algorithm
passing
the
value
of
the
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
member
as
new
</ins>
<em>
<del class="diff-old">prefix
</del>
<ins class="diff-chg">element
</ins>
</em>
and
<del class="diff-old">takes
a
possibly
null
identifier
and
returns
a
</del>
<em>
<ins class="diff-chg">id
</ins></em><ins class="diff-chg">
as
</ins>
new
<del class="diff-old">identifier
based
on
</del>
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
<ins class="diff-chg">active
subject
</ins></a>.<ins class="diff-chg">
Then
remove
the
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
member
from
</ins>
<em>
<del class="diff-old">prefix
</del>
<ins class="diff-chg">element
</ins>
</em>.
<del class="diff-old">The
variable
</del>
</li>
<li>
<ins class="diff-chg">Finally
for
each
</ins>
<em>
<del class="diff-old">next
identifier
</del>
<ins class="diff-chg">property
</ins>
</em>
<del class="diff-old">is
initialized
to
</del>
<ins class="diff-chg">-
</ins>
<em>
<del class="diff-old">prefix
appended
with
0
.
The
default
</del>
value
<del class="diff-old">of
</del>
</em>
<ins class="diff-chg">pair
in
</ins>
<em>
<del class="diff-old">prefix
</del>
<ins class="diff-chg">element
</ins>
</em>
<del class="diff-old">is
_:t
.
</del>
<ins class="diff-chg">ordered
by
</ins><em><ins class="diff-chg">
property
</ins></em><ins class="diff-chg">
perform
the
following
steps:
</ins>
<ol class="algorithm">
<li>
If
<ins class="diff-new">no
</ins><em><ins class="diff-new">
property
</ins></em><ins class="diff-new">
member
exists
in
</ins>
the
<del class="diff-old">old
identifier
is
not
null
</del>
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
<ins class="diff-chg">JSON
object
</ins>
</a>
<del class="diff-old">and
</del>
<ins class="diff-chg">which
</ins>
is
<del class="diff-old">in
the
identifier
map
,
return
</del>
the
<del class="diff-old">mapped
identifier.
Otherwise,
if
</del>
<ins class="diff-chg">value
of
</ins>
the
<del class="diff-old">old
identifier
is
not
null
,
create
a
new
entry
in
</del>
<em>
<del class="diff-old">identifier
map
</del>
<ins class="diff-chg">id
</ins>
</em>
<del class="diff-old">initialized
to
the
current
value
</del>
<ins class="diff-chg">member
</ins>
of
<em>
<del class="diff-old">next
identifier
.
Increment
next
identifier
</del>
<ins class="diff-chg">activeGraph
</ins>
</em>
<del class="diff-old">by
adding
one
to
the
integer
suffix.
Return
</del>
<ins class="diff-chg">create
</ins>
the
<del class="diff-old">mapped
identifier.
</del>
<ins class="diff-chg">member
and
initialize
its
value
to
an
empty
</ins><a class="tref internalDFN" title="array" href="#dfn-array"><ins class="diff-chg">
array
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
increment
</del>
<ins class="diff-chg">Recursively
invoke
this
algorithm
passing
</ins>
<em>
<del class="diff-old">next
identifier
</del>
<ins class="diff-chg">value
</ins>
</em>
<del class="diff-old">by
adding
one
to
the
integer
suffix
</del>
<ins class="diff-chg">as
new
</ins><em><ins class="diff-chg">
element
</ins></em>,<em><ins class="diff-chg">
id
</ins></em><ins class="diff-chg">
as
new
</ins><a class="tref internalDFN" title="active_subject" href="#dfn-active_subject"><ins class="diff-chg">
active
subject
</ins></a>,
and
<del class="diff-old">return
its
original
value.
</del>
<em>
<ins class="diff-chg">property
</ins></em><ins class="diff-chg">
as
new
</ins><a class="tref internalDFN" title="active_property" href="#dfn-active_property"><ins class="diff-chg">
active
property
</ins></a>.</li></ol></li></ol>
</li>
</ol>
</section>
<section id="rdf-conversion-algorithms">
<h3>
<span class="secno">
<del class="diff-old">4.10
</del>
<ins class="diff-chg">5.16
</ins>
</span>
RDF
Conversion
<ins class="diff-new">Algorithms
</ins>
</h3>
<p>
<del class="diff-old">A
JSON-LD
document
may
be
converted
between
other
RDF-compatible
document
formats
using
the
algorithms
specified
in
this
section.
The
JSON-LD
Processing
Model
</del>
<ins class="diff-chg">This
specification
</ins>
describes
<del class="diff-old">processing
rules
for
extracting
RDF
from
a
</del>
<ins class="diff-chg">algorithms
to
transform
</ins>
JSON-LD
<del class="diff-old">document,
and
for
transforming
</del>
<ins class="diff-chg">documents
to
</ins>
an
array
of
<del class="diff-old">Quad
</del>
<ins class="diff-chg">RDF
</ins><a class="tref internalDFN" title="quad" href="#dfn-quad"><ins class="diff-chg">
quads
</ins>
</a>
<del class="diff-old">retrieved
by
processing
another
serialization
format
into
JSON-LD.
</del>
<ins class="diff-chg">and
vice-versa.
</ins>
Note
that
many
uses
of
JSON-LD
may
not
require
generation
of
RDF.
</p>
<p>
The
processing
algorithms
described
in
this
section
are
provided
in
order
to
demonstrate
how
one
might
implement
a
JSON-LD
to
RDF
processor.
Conformant
implementations
are
only
required
to
produce
the
same
type
and
number
of
<a class="tref internalDFN" title="quad" href="#dfn-quad">
quads
<del class="diff-old">during
the
output
process
and
</del>
</a>
<ins class="diff-chg">but
</ins>
are
not
required
to
implement
the
algorithm
exactly
as
described.
</p>
<del class="diff-old">4.10.1
Overview
This
section
is
non-normative.
JSON-LD
is
intended
to
have
an
easy
to
parse
grammar
that
closely
models
existing
practice
in
using
JSON
for
describing
object
representations.
This
allows
the
use
of
existing
libraries
for
parsing
JSON.
As
with
other
grammars
used
for
describing
Linked
Data
,
a
key
concept
is
that
of
a
node
in
a
linked
data
graph
.
Nodes
may
be
of
three
basic
types.
The
first
is
the
IRI
</del>
<div class="issue">
<del class="diff-old">,
which
is
used
to
refer
to
node
s
in
other
linked
data
graph
s.
The
second
is
the
blank
node
,
which
are
nodes
for
which
an
external
name
does
not
exist,
or
is
not
known.
The
third
is
a
Literal
,
which
express
values
such
as
strings,
dates
and
other
information
having
a
lexical
form,
possibly
including
an
explicit
language
or
datatype.
Data
described
with
JSON-LD
may
be
considered
to
be
a
graph
made
up
of
subject
and
object
nodes
related
via
a
property
node
.
Specific
implementations
may
also
choose
to
operate
on
the
document
as
a
normal
JSON
description
of
objects
having
attributes.
Both
approaches
are
valid
ways
to
interact
with
JSON-LD
documents.
</del>
<div class="issue-title">
<del class="diff-old">4.10.2
</del>
<span>
<ins class="diff-chg">Issue
</ins>
</span>
<del class="diff-old">Parsing
Examples
This
section
is
non-normative.
The
following
examples
show
simple
transformations
of
JSON-LD
documents
to
Turtle
[
TURTLE-TR
].
The
first
example
uses
a
simple
document
containing
a
simple
FOAF
profile:
{
  &quot;@context&quot;: {&quot;foaf&quot;: &quot;http://xmlns.com/foaf/0.1/&quot;},
  &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
  &quot;@type&quot;: &quot;foaf:Person&quot;,
  &quot;foaf:name&quot;: &quot;Gregg Kellogg&quot;,
  &quot;foaf:knows&quot;: {
    &quot;@type&quot;: &quot;foaf:Person&quot;,
    &quot;foaf:name&quot;: &quot;Manu Sporny&quot;
  }
}
This
translates
fairly
directly
to
a
similar
Turtle
document:
@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt;.
&lt;http://greggkellogg.net/foaf#me&gt; a foaf:Person;
  foaf:name &quot;Gregg Kellogg&quot;;
foaf:knows
[
a
foaf:Person;
foaf:name
&quot;Manu
Sporny&quot;].
The
actual
parsing
steps
first
require
that
the
JSON-LD
document
be
expanded,
to
eliminate
the
@context
:
[{
  &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
  &quot;@type&quot;: [&quot;http://xmlns.com/foaf/0.1/Person&quot;],
  &quot;http://xmlns.com/foaf/0.1/name&quot;: [{&quot;@value&quot;: &quot;Gregg Kellogg&quot;}],
  &quot;http://xmlns.com/foaf/0.1/knows&quot;: [{
    &quot;@type&quot;: [&quot;http://xmlns.com/foaf/0.1/Person&quot;],
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [{&quot;@value&quot;: &quot;Manu Sporny&quot;}]
  }]
}]
</del>
</div>
<del class="diff-old">The
process
of
translating
this
to
RDF
then
operates
over
each
node
definition
to
find
a
subject,
each
property
to
find
an
RDF
predicate
,
and
each
value
of
that
property
to
find
an
object
.
In
this
case,
each
property
has
just
a
single
object:
foaf:name
identifies
a
literal
,
and
foaf:knows
identifies
a
second
node
definition
similar
to
Turtle's
blankNodePropertyList
.
After
expansion,
JSON-LD
numbers
,
booleans
,
typed
literals
,
language-tagged-strings
,
and
IRIs
become
explicit,
and
can
be
directly
transformed
into
their
RDF
representations.
[{
  &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
  &quot;@type&quot;: [&quot;http://xmlns.com/foaf/0.1/Person&quot;],
  &quot;http://xmlns.com/foaf/0.1/name&quot;: [{&quot;@value&quot;: &quot;Gregg Kellogg&quot;}],
  &quot;http://xmlns.com/foaf/0.1/currentProject&quot;: [{&quot;@id&quot;: &quot;http://json-ld.org/&quot;}],
  &quot;http://xmlns.com/foaf/0.1/birthday&quot;: [{
    &quot;@value&quot;: &quot;1957-02-27&quot;,
    &quot;@type&quot;: &quot;http://www.w3.org/2001/XMLSchema#date&quot;
  }],
  &quot;http://xmlns.com/foaf/0.1/knows&quot;: [{
    &quot;@type&quot;: [&quot;http://xmlns.com/foaf/0.1/Person&quot;],
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [{&quot;@value&quot;: &quot;Manu Sporny&quot;}]
  }]
}]
</del>
<del class="diff-old">Translates
to:
</del>
<p class="">
<ins class="diff-chg">This
algorithm
hasn't
been
updated
yet.
</ins>
</p>
<del class="diff-old">@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt;.
@prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;.
&lt;http://greggkellogg.net/foaf#me&gt; a foaf:Person;
  foaf:name &quot;Gregg Kellogg&quot;;
  foaf:currentProject &lt;http://json-ld.org/&gt;;
  foaf:birthday &quot;1957-02-27&quot;^^xsd:date;
foaf:knows
[
a
foaf:Person;
foaf:name
&quot;Manu
Sporny&quot;].
</del>
</div>
<section id="convert-to-rdf-algorithm">
<h4>
<span class="secno">
<del class="diff-old">4.10.3
</del>
<ins class="diff-chg">5.16.1
</ins>
</span>
Convert
to
RDF
Algorithm
</h4>
<p>
The
algorithm
below
is
designed
for
in-memory
implementations
with
random
access
to
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
elements.
</p>
<p>
A
conforming
JSON-LD
processor
implementing
RDF
conversion
<em class="rfc2119" title="must">
must
</em>
implement
a
processing
algorithm
that
results
in
the
same
set
of
RDF
<a class="tref internalDFN" title="quad" href="#dfn-quad">
<del class="diff-old">Quads
</del>
<ins class="diff-chg">quads
</ins>
</a>
that
the
following
algorithm
generates:
</p>
<p>
The
algorithm
takes
four
input
variables:
a
<em>
element
</em>
to
be
converted,
an
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
graph
name
</a>.
To
begin,
the
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
graph
name
</a>
are
set
to
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>,
and
<em>
element
</em>
is
set
to
the
result
of
performing
the
<a href="#expansion-algorithm">
Expansion
Algorithm
</a>
on
the
<a class="tref internalDFN" title="json-ld_input" href="#dfn-json-ld_input">
JSON-LD
input
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">which
is
expected
to
be
a
a
well-formed
JSON-LD
document
as
defined
in
[
</ins><cite><a class="bibref" href="#bib-JSON-LD"><ins class="diff-chg">
JSON-LD
</ins></a></cite><ins class="diff-chg">
].
</ins>
This
removes
any
existing
context
to
allow
the
given
context
to
be
cleanly
applied.
</p>
<ol class="algorithm">
<li id="processing-step-associative">
If
<em>
element
</em>
is
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>,
perform
the
following
steps:
<ol class="algorithm">
<li>
Set
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>.
</li>
<li>
If
<em>
element
</em>
has
a
<code>
@value
</code>
property:
<ol class="algorithm">
<li>
If
the
value
of
<code>
@value
</code>
is
a
<a class="tref internalDFN" title="number" href="#dfn-number">
number
</a>,
set
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
a
<a class="tref internalDFN" title="typed_value" href="#dfn-typed_value">
typed
<del class="diff-old">literal
</del>
<ins class="diff-chg">value
</ins>
</a>
using
a
<del class="diff-old">string
representation
</del>
<a class="tref internalDFN" title="canonical_lexical_form" href="#dfn-canonical_lexical_form">
<ins class="diff-chg">canonical
lexical
form
</ins></a>
of
the
value
as
defined
in
the
section
<a href="#data-round-tripping">
Data
Round
Tripping
</a>.
Set
datatype
to
the
value
of
the
<code>
@type
</code>
property
if
it
exists,
otherwise
either
<code>
xsd:integer
</code>
or
<code>
xsd:double
</code>,
depending
on
if
the
value
contains
a
fractional
and/or
an
exponential
component.
</li>
<li>
Otherwise,
if
the
value
of
<code>
@value
</code>
is
<strong>
true
</strong>
or
<strong>
false
</strong>,
set
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
a
<a class="tref internalDFN" title="typed_value" href="#dfn-typed_value">
typed
<del class="diff-old">literal
</del>
<ins class="diff-chg">value
</ins>
</a>
created
from
the
<del class="diff-old">string
representation
</del>
<a class="tref internalDFN" title="canonical_lexical_form" href="#dfn-canonical_lexical_form">
<ins class="diff-chg">canonical
lexical
form
</ins></a>
of
the
value.
Set
datatype
to
the
value
of
the
<code>
@type
</code>
property
if
it
exists,
otherwise
<code>
xsd:boolean
</code>.
</li>
<li>
Otherwise,
if
<em>
element
</em>
contains
a
<code>
@type
</code>
property,
set
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
a
<a class="tref internalDFN" title="typed_value" href="#dfn-typed_value">
typed
<del class="diff-old">literal
</del>
<ins class="diff-chg">value
</ins>
</a>.
</li>
<li>
Otherwise,
if
<em>
element
</em>
contains
a
<code>
@language
</code>
property,
set
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
a
<a class="tref internalDFN" title="language-tagged_string" href="#dfn-language-tagged_string">
language-tagged
string
</a>.
</li>
<li>
Otherwise,
set
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
a
<a class="tref internalDFN" title="typed_value" href="#dfn-typed_value">
typed
<del class="diff-old">literal
</del>
<ins class="diff-chg">value
</ins>
</a>
using
<code>
xsd:string
</code>
as
the
datatype.
</li>
</ol>
</li>
<li>
If
<em>
element
</em>
has
a
<code>
@list
</code>
property
the
value
<em class="rfc2119" title="must">
must
</em>
be
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>.
Process
its
value
as
a
list
as
described
in
<a href="#list-conversion">
List
Conversion
</a>
using
the
return
value
as
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
</li>
<li>
If
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
is
not
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>:
<ol class="algorithm">
<li>
If
neither
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>
nor
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
are
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>,
generate
a
<a class="tref internalDFN" title="quad" href="#dfn-quad">
Quad
</a>
representing
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>,
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>,
and
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
graph
name
</a>.
</li>
<li>
Return
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>.
</li>
</ol>
</li>
<li id="processing-step-subject">
If
<em>
element
</em>
has
a
<code>
@id
</code>
property,
the
value
<em class="rfc2119" title="must">
must
</em>
be
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>,
set
the
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>
to
the
previously
expanded
value
(either
a
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
or
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
).
</li>
<li>
Otherwise,
if
<em>
element
</em>
does
not
have
a
<code>
@id
</code>
property,
set
the
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>
to
newly
generated
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>.
</li>
<li>
Process
each
<em>
property
</em>
and
<em>
value
</em>
in
<em>
element
</em>,
ordered
by
<em>
property
</em>,
as
follows:
<ol class="algorithm">
<li>
If
<em>
property
</em>
is
<code>
@type
</code>,
set
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
to
<code>
rdf:type
</code>.
</li>
<li>
Otherwise,
if
<em>
property
</em>
is
<code>
@graph
</code>,
process
<em>
value
</em>
algorithm
recursively,
using
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>
as
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
graph
name
</a>
and
null
values
for
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>
and
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
then
proceed
to
next
property.
</li>
<li>
Otherwise,
if
<em>
property
</em>
is
a
<a class="tref internalDFN" title="keyword" href="#dfn-keyword">
keyword
</a>,
skip
this
step.
</li>
<li>
Otherwise,
set
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
to
the
<a class="tref internalDFN" title="expanded_iri_form" href="#dfn-expanded_iri_form">
<ins class="diff-new">expanded
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">value
</del>
<ins class="diff-chg">form
</ins></a>
of
<em>
property
</em>.
</li>
<li>
Process
<em>
value
</em>
recursively
using
this
algorithm,
passing
copies
of
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
graph
name
</a>.
</li>
</ol>
</li>
<li>
Set
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>.
</li>
</ol>
</li>
<li>
Otherwise,
if
<em>
element
</em>
is
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>,
process
each
value
in
the
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
as
follows,
process
<em>
element
</em>
recursively
using
this
algorithm,
using
copies
of
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>,
and
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
graph
name
</a>.
</li>
<li>
Otherwise,
if
<em>
element
</em>
is
a
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>,
then
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
must
be
<code>
rdf:type
</code>
so
set
the
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
to
an
<a class="tref internalDFN" title="iri" href="#dfn-iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</li>
<li>
If
any
of
these
steps
created
an
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
and
neither
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>
nor
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
are
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>,
generate
a
<a class="tref internalDFN" title="quad" href="#dfn-quad">
Quad
</a>
using
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>,
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
and
<a class="tref internalDFN" title="graph_name" href="#dfn-graph_name">
graph
name
</a>.
</li>
<li>
Return
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>.
</li>
</ol>
</section>
<section id="list-conversion" typeof="bibo:Chapter" resource="#list-conversion" rel="bibo:chapter">
<h4>
<span class="secno">
<del class="diff-old">4.10.4
</del>
<ins class="diff-chg">5.16.2
</ins>
</span>
List
Conversion
</h4>
<p>
List
Conversion
is
the
process
of
taking
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
of
values
and
adding
them
to
a
newly
created
<cite>
<a href="http://www.w3.org/TR/rdf-schema/#ch_collectionvocab">
RDF
Collection
</a>
</cite>
(see
[
<cite>
<a class="bibref" href="#bib-RDF-SCHEMA">
RDF-SCHEMA
</a>
</cite>
])
by
linking
each
element
of
the
list
using
<code>
rdf:first
</code>
and
<code>
rdf:next
</code>,
terminating
the
list
with
<code>
rdf:nil
</code>
using
the
following
sequence:
</p>
<p>
The
algorithm
is
invoked
with
an
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>
<em>
array
</em>,
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
returns
a
value
to
be
used
as
an
<a class="tref internalDFN" title="active_object" href="#dfn-active_object">
active
object
</a>
in
the
calling
location.
</p>
<div class="note">
<div class="note-title">
<span>
Note
</span>
</div>
<div class="">
This
algorithm
does
not
support
lists
containing
lists.
</div>
</div>
<div class="issue">
<div class="issue-title">
<span>
<ins class="diff-new">Issue
</ins></span></div><p class=""><ins class="diff-new">
This
algorithm
hasn't
been
updated
yet.
</ins></p></div>
<ol class="algorithm">
<li>
If
<em>
array
</em>
is
empty
return
<code>
rdf:nil
</code>.
</li>
<li>
Otherwise,
generate
a
<a class="tref internalDFN" title="quad" href="#dfn-quad">
Quad
</a>
using
using
the
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>
and
a
newly
generated
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
identified
as
<em>
first
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
</em>.
</li>
<li>
For
each
element
in
<em>
array
</em>
other
than
the
last
element:
<ol class="algorithm">
<li>
Create
a
processor
state
using
<em>
first
blank
node
</em>
as
the
<a class="tref internalDFN" title="active_subject" href="#dfn-active_subject">
active
subject
</a>,
and
<code>
rdf:first
</code>
as
the
<a class="tref internalDFN" title="active_property" href="#dfn-active_property">
active
property
</a>.
<ol class="algorithm">
<li>
Process
the
value
starting
at
<a href="#processing-step-associative">
Step
1
</a>.
</li>
<li>
Proceed
using
the
previous
<a class="tref internalDFN" title="processor_state" href="#dfn-processor_state">
processor
state
</a>.
</li>
</ol>
</li>
<li>
Unless
this
is
the
last
element
in
<em>
array
</em>,
generate
a
new
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>
identified
as
<em>
rest
blank
node
</em>,
otherwise
use
<code>
rdf:nil
</code>.
</li>
<li>
Generate
a
new
<a class="tref internalDFN" title="quad" href="#dfn-quad">
Quad
</a>
using
<em>
first
blank
node
</em>,
<code>
rdf:rest
</code>
and
<em>
rest
blank
node
</em>.
</li>
<li>
Set
<em>
first
blank
node
</em>
to
<em>
rest
blank
node
</em>.
</li>
<li>
Return
<em>
first
blank
node
</em>.
</li>
</ol>
</li>
</ol>
</section>
<section id="convert-from-rdf-algorithm">
<h4>
<span class="secno">
<del class="diff-old">4.10.5
</del>
<ins class="diff-chg">5.16.3
</ins>
</span>
Convert
from
RDF
Algorithm
</h4>
<p>
In
some
cases,
data
exists
natively
in
<del class="diff-old">Triples
</del>
<ins class="diff-chg">the
form
of
triples
</ins>
or
<del class="diff-old">Quads
form;
</del>
<ins class="diff-chg">or
</ins><a class="tref internalDFN" title="quad" href="#dfn-quad"><ins class="diff-chg">
quads
</ins></a><ins class="diff-chg">
;
</ins>
for
example,
if
the
data
was
originally
represented
in
an
RDF
graph
or
triple/quad
store.
This
algorithm
is
designed
to
simply
translate
an
array
of
<del class="diff-old">Quads
</del>
<a class="tref internalDFN" title="quad" href="#dfn-quad">
<ins class="diff-chg">quads
</ins>
</a>
into
a
JSON-LD
document.
</p>
<p>
When
expanding
<a class="tref internalDFN" title="typed_value" href="#dfn-typed_value">
typed
<del class="diff-old">literal
</del>
values
</a>
having
a
datatype
of
<code>
xsd:string
</code>,
the
<code>
@type
</code>
<em class="rfc2119" title="must not">
must
not
</em>
be
set
to
<code>
xsd:string
</code>
and
the
resulting
value
<em class="rfc2119" title="must">
must
</em>
have
only
a
<code>
@value
</code>
property.
</p>
<p>
The
conversion
algorithm
takes
a
single
parameter
<em>
input
</em>
in
the
form
of
an
array
of
<a class="tref internalDFN" title="quad" href="#dfn-quad">
Quad
</a>
representations.
</p>
<div class="issue">
<div class="issue-title">
<span>
<ins class="diff-new">Issue
</ins></span></div><p class=""><ins class="diff-new">
This
algorithm
hasn't
been
updated
yet.
</ins></p></div>
<ol class="algorithm">
<li id="new_graph">
Construct
<em>
defaultGraph
</em>
as
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
containing
<em>
nodes
</em>
and
<em>
listMap
</em>,
each
an
empty
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>.
</li>
<li>
Construct
<em>
graphs
</em>
as
a
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
containing
<em>
defaultGraph
</em>
identified
by
an
empty
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>.
</li>
<li>
For
each
<a class="tref internalDFN" title="quad" href="#dfn-quad">
quad
</a>
in
<em>
input
</em>:
<ol class="algorithm">
<li>
Set
<em>
graph
</em>
to
the
entry
in
<em>
graphs
</em>
identified
by
<em>
name
</em>,
initializing
it
to
a
new
entry
using
the
mechanism
described
in
<a href="#new_graph">
Step
1
</a>.
</li>
<li>
If
<em>
property
</em>
is
<code>
rdf:first
</code>,
use
the
entry
in
<em>
graph.listMap
</em>
indexed
by
<em>
subject
</em>,
initializing
it
to
a
new
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
if
nesessary.
Represent
<em>
object
</em>
in
<a class="tref internalDFN" title="expanded_form" href="#dfn-expanded_form">
expanded
<del class="diff-old">form,
</del>
<ins class="diff-chg">form
</ins></a>,
as
described
in
<a href="#value-expansion">
Value
Expansion
</a>.
Add
the
resulting
<em>
object
representation
</em>
to
the
entry
indexed
by
<em>
first
</em>,
and
skip
to
the
next
<del class="diff-old">quad.
</del>
<a class="tref internalDFN" title="quad" href="#dfn-quad">
<ins class="diff-chg">quad
</ins></a>.
</li>
<li>
If
<em>
property
</em>
is
<code>
rdf:rest
</code>:
<ol class="algorithm">
<li>
If
<em>
object
</em>
is
a
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>,
use
the
entry
in
<em>
graph.listMap
</em>
indexed
by
<em>
subject
</em>,
initializing
it
to
a
new
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
if
necessary.
Add
the
<em>
nominalValue
</em>
of
<em>
object
</em>
to
the
entry
indexed
by
<em>
rest
</em>.
</li>
<li>
Skip
to
the
next
<del class="diff-old">quad.
</del>
<a class="tref internalDFN" title="quad" href="#dfn-quad">
<ins class="diff-chg">quad
</ins></a>.
</li>
</ol>
</li>
<li>
If
<em>
name
</em>
is
not
<a class="tref internalDFN" title="null" href="#dfn-null">
null
</a>,
and
<em>
defaultGraph.nodes
</em>
does
not
contain
an
entry
for
<em>
name
</em>,
create
a
new
entry
for
<em>
name
</em>
from
a
new
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
with
key/value
pair
of
<code>
@id
</code>
and
<del class="diff-old">a
string
representation
of
</del>
<em>
name
<del class="diff-old">.
</del>
</em>
<ins class="diff-chg">represented
in
</ins><a class="tref internalDFN" title="expanded_iri_form" href="#dfn-expanded_iri_form"><ins class="diff-chg">
expanded
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
form
</ins></a>.
</li>
<li>
Set
<em>
value
</em>
as
the
entry
from
<em>
graph.nodes
</em>
for
<em>
subject
</em>,
initializing
it
to
a
new
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
with
key/value
pair
of
<code>
@id
</code>
and
<del class="diff-old">a
string
representation
of
</del>
<em>
subject
</em>
<ins class="diff-new">represented
in
</ins><a class="tref internalDFN" title="expanded_iri_form" href="#dfn-expanded_iri_form"><ins class="diff-new">
expanded
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
form
</ins></a>
if
necessary.
</li>
<li>
If
<em>
property
</em>
is
<code>
rdf:type
</code>,
<em>
<ins class="diff-chg">object
</ins></em><ins class="diff-chg">
is
not
a
</ins><a class="tref internalDFN" title="json-ld_value" href="#dfn-json-ld_value"><ins class="diff-chg">
JSON-LD
value
</ins></a>,
and
the
<code class="idlMemberName">
<a href="#widl-JsonLdOptions-useRdfType">
useRdfType
</a>
</code>
option
is
not
present
or
<a class="tref internalDFN" title="false" href="#dfn-false">
false
</a>:
<ol class="algorithm">
<li>
Append
<del class="diff-old">the
string
representation
of
</del>
<em>
object
</em>
<ins class="diff-new">represented
in
</ins><a class="tref internalDFN" title="expanded_iri_form" href="#dfn-expanded_iri_form"><ins class="diff-new">
expanded
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
form
</ins></a>
to
the
array
value
for
the
key
<code>
@type
</code>,
creating
an
entry
in
<em>
value
</em>
if
necessary.
</li>
</ol>
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
<em>
object
</em>
is
a
<a class="tref internalDFN" title="typed_value" href="#dfn-typed_value">
typed
<del class="diff-old">literal
</del>
<ins class="diff-chg">value
</ins>
</a>
and
the
<code class="idlMemberName">
<a href="#widl-JsonLdOptions-useNativeTypes">
useNativeTypes
</a>
</code>
option
is
set
to
<a class="tref internalDFN" title="true" href="#dfn-true">
true
</a>:
<ol class="algorithm">
<li>
Generate
a
<em>
converted
value
</em>:
<ol class="algorithm">
<li>
If
the
literal's
type
is
<code>
xsd:boolean
</code>,
the
<em>
converted
value
</em>
is
<a class="tref internalDFN" title="true" href="#dfn-true">
true
</a>
if
the
literal
matches
the
value
<code>
true
</code>
or
<code>
false
</code>
if
the
literal
matches
the
value
<code>
false
</code>.
</li>
<li>
If
the
literal's
type
is
<code>
xsd:integer
</code>
or
<code>
xsd:double
</code>,
try
to
convert
the
literal
to
a
JSON
<a class="tref internalDFN" title="number" href="#dfn-number">
number
</a>.
If
the
conversion
is
successful,
store
the
result
in
<em>
converted
value
</em>,
otherwise
set
<em>
converted
value
</em>
to
<em>
value
</em>.
</li>
<li>
Otherwise,
do
not
perform
a
conversion.
Set
the
<em>
converted
value
</em>
to
the
<em>
value
</em>.
</li>
</ol>
</li>
<li>
Append
the
<em>
converted
value
</em>
to
the
array
value
for
the
key,
creating
an
entry
in
<em>
value
</em>
if
necessary.
</li>
</ol>
</li>
<li>
Otherwise,
if
<em>
object
</em>
is
<code>
rdf:nil
</code>:
<ol class="algorithm">
<li>
Let
<em>
key
</em>
be
<del class="diff-old">the
string
representation
of
</del>
<em>
property
<del class="diff-old">.
</del>
</em>
<ins class="diff-chg">expressed
in
</ins><a class="tref internalDFN" title="expanded_iri_form" href="#dfn-expanded_iri_form"><ins class="diff-chg">
expanded
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
form
</ins></a>.
</li>
<li>
Append
an
empty
<code>
@list
</code>
representation
to
the
array
value
for
<em>
key
</em>,
creating
an
entry
in
<em>
value
</em>
if
necessary.
</li>
</ol>
</li>
<li>
Otherwise,
<ol class="algorithm">
<li>
Let
<em>
key
</em>
be
<del class="diff-old">the
string
representation
of
</del>
<em>
property
</em>
<ins class="diff-new">expressed
in
</ins><a class="tref internalDFN" title="expanded_iri_form" href="#dfn-expanded_iri_form"><ins class="diff-new">
expanded
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
form
</ins></a>
and
let
<em>
object
representation
</em>
be
<em>
object
</em>
represented
in
<a class="tref internalDFN" title="expanded_form" href="#dfn-expanded_form">
expanded
form
</a>
as
described
in
<a href="#value-expansion">
Value
Expansion
</a>.
</li>
<li>
If
<em>
object
</em>
is
a
<a class="tref internalDFN" title="blank_node" href="#dfn-blank_node">
blank
node
</a>,
use
the
entry
in
<em>
graph.listMap
</em>
indexed
by
<em>
object
</em>,
initializing
it
to
a
new
<a class="tref internalDFN" title="json_object" href="#dfn-json_object">
JSON
object
</a>
if
nesessary.
Add
an
entry
for
<em>
head
</em>
with
<em>
object
representation
</em>.
</li>
<li>
Append
<em>
object
representation
</em>
to
the
array
value
for
<em>
key
</em>,
creating
an
entry
in
<em>
value
</em>
if
necessary.
</li>
</ol>
</li>
</ol>
</li>
<li>
For
each
<em>
name
</em>
and
<em>
graph
</em>
in
<em>
graphs
</em>:
<ol class="algorithm">
<li>
For
each
<em>
subject
</em>
and
<em>
entry
</em>
in
<em>
graph
</em>
where
<em>
entry
</em>
has
both
<em>
head
</em>
and
<em>
first
</em>
keys:
<ol class="algorithm">
<li>
Set
<em>
value
</em>
to
the
value
of
<em>
head
</em>
in
<em>
entry
</em>.
</li>
<li>
Remove
the
entry
for
<code>
@id
</code>
in
<em>
value
</em>.
</li>
<li>
Add
an
entry
to
<em>
value
</em>
for
<code>
@list
</code>
initialized
to
a
new
array
containing
the
value
of
<em>
first
</em>
from
<em>
entry
</em>.
</li>
<li>
While
<em>
entry
</em>
has
a
key
for
<em>
rest
</em>:
<ol class="algorithm">
<li>
Set
<em>
entry
</em>
to
the
value
of
<em>
graph.listMap
</em>
for
<em>
entry.rest
</em>.
</li>
<li>
Add
the
value
for
<em>
entry.first
</em>
to
the
list
array.
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>
Create
<em>
array
</em>
as
an
empty
<a class="tref internalDFN" title="array" href="#dfn-array">
array
</a>.
</li>
<li>
For
each
<em>
subject
</em>
and
<em>
entry
</em>
in
<em>
defaultGraph.nodes
</em>
ordered
by
<em>
subject
</em>:
<ol class="algorithm">
<li>
Add
<em>
entry
</em>
to
<em>
array
</em>.
</li>
<li>
If
<em>
graphs
</em>
has
an
entry
for
<em>
subject
</em>,
add
a
property
<code>
@graph
</code>
in
<em>
entry
</em>
containing
the
ordered
entries
from
<em>
graphs[subject].nodes
</em>.
</li>
</ol>
</li>
<li>
Return
<em>
array
</em>
as
the
result.
</li>
</ol>
</section>
<section id="data-round-tripping">
<h4>
<span class="secno">
<del class="diff-old">5.
</del>
<ins class="diff-chg">5.16.4
</ins>
</span>
Data
Round
Tripping
</h4>
<p>
When
<a href="#rdf-conversion">
converting
JSON-LD
to
RDF
</a>
JSON-native
types
such
as
<em>
numbers
</em>
and
<em>
booleans
</em>
are
automatically
coerced
to
<strong>
xsd:integer
</strong>,
<strong>
xsd:double
</strong>,
or
<strong>
xsd:boolean
</strong>.
Implementers
<em class="rfc2119" title="must">
must
</em>
ensure
that
the
result
is
<del class="diff-old">a
</del>
<ins class="diff-chg">in
</ins><a class="tref internalDFN" title="canonical_lexical_form" href="#dfn-canonical_lexical_form">
canonical
lexical
form
<del class="diff-old">in
the
form
of
a
string
</del>
</a>.
A
<dfn title="canonical_lexical_form" id="dfn-canonical_lexical_form">
canonical
lexical
form
</dfn>
is
a
set
of
literals
from
among
the
valid
set
of
literals
for
a
datatype
such
that
there
is
a
one-to-one
mapping
between
the
<a class="tref internalDFN" title="canonical_lexical_form" href="#dfn-canonical_lexical_form">
canonical
lexical
form
</a>
and
a
value
in
the
value
space
as
defined
in
[
<cite>
<a class="bibref" href="#bib-XMLSCHEMA11-2">
XMLSCHEMA11-2
</a>
</cite>
].
In
other
words,
every
value
<em class="rfc2119" title="must">
must
</em>
be
converted
to
a
deterministic
<a class="tref internalDFN" title="string" href="#dfn-string">
string
</a>
representation.
</p>
<p>
The
canonical
lexical
form
of
an
<em>
integer
</em>,
i.e.,
a
number
without
fractions
or
a
number
coerced
to
<strong>
xsd:integer
</strong>,
is
a
finite-length
sequence
of
decimal
digits
(
<code>
0-9
</code>
)
with
an
optional
leading
minus
sign;
leading
zeroes
are
prohibited.
To
convert
the
number
in
JavaScript,
implementers
can
use
the
following
snippet
of
code:
</p>
<div class="example">
<div class="example-title">
<span>
Example
<del class="diff-old">25
</del>
<ins class="diff-chg">12
</ins>
</span>
</div>
<pre class="example">
(value).toFixed(0).toString()
</pre>
</div>
<p>
The
canonical
lexical
form
of
a
<em>
double
</em>,
i.e.,
a
number
with
fractions
or
a
number
coerced
to
<strong>
xsd:double
</strong>,
consists
of
a
mantissa
followed
by
the
character
&quot;E&quot;,
followed
by
an
exponent.
The
mantissa
<em class="rfc2119" title="must">
must
</em>
be
a
decimal
number.
The
exponent
<em class="rfc2119" title="must">
must
</em>
be
an
integer.
Leading
zeroes
and
a
preceding
plus
sign
(
<code>
+
</code>
)
are
prohibited
in
the
exponent.
If
the
exponent
is
zero,
it
must
be
indicated
by
<code>
E0
</code>.
For
the
mantissa,
the
preceding
optional
plus
sign
is
prohibited
and
the
decimal
point
is
required.
Leading
and
trailing
zeroes
are
prohibited
subject
to
the
following:
number
representations
must
be
normalized
such
that
there
is
a
single
digit
which
is
non-zero
to
the
left
of
the
decimal
point
and
at
least
a
single
digit
to
the
right
of
the
decimal
point
unless
the
value
being
represented
is
zero.
The
canonical
representation
for
zero
is
<code>
0.0E0
</code>.
<strong>
xsd:double
</strong>
's
value
space
is
defined
by
the
IEEE
double-precision
64-bit
floating
point
type
[
<cite>
<a class="bibref" href="#bib-IEEE-754-1985">
IEEE-754-1985
</a>
</cite>
];
in
JSON-LD
the
mantissa
is
rounded
to
15
digits
after
the
decimal
point.
</p>
<p>
To
convert
the
number
in
JavaScript,
implementers
can
use
the
following
snippet
of
code:
</p>
<div class="example">
<div class="example-title">
<span>
Example
<del class="diff-old">26
</del>
<ins class="diff-chg">13
</ins>
</span>
</div>
<pre class="example">
(value).toExponential(15).replace(/(\d)0*e\+?/,'$1E')
</pre>
</div>
<div class="note">
<div class="note-title">
<span>
Note
</span>
</div>
<p class="">
When
data
such
as
decimals
need
to
be
normalized,
JSON-LD
authors
should
not
use
values
that
are
going
to
undergo
automatic
conversion.
This
is
due
to
the
lossy
nature
of
<strong>
xsd:double
</strong>
values.
Authors
should
instead
use
the
expanded
object
form
to
set
the
canonical
lexical
form
directly.
</p>
</div>
<p>
The
canonical
lexical
form
of
the
<em>
boolean
</em>
values
<code>
true
</code>
and
<code>
false
</code>
are
the
strings
<strong>
true
</strong>
and
<strong>
false
</strong>.
</p>
<p>
When
JSON-native
<a class="tref internalDFN" title="number" href="#dfn-number">
number
</a>
s,
are
type
coerced,
lossless
data
round-tripping
can
not
be
guaranted
as
rounding
errors
might
occur.
Additionally,
only
literals
typed
as
<strong>
xsd:integer
</strong>,
<strong>
xsd:double
</strong>,
and
<strong>
xsd:boolean
</strong>
are
automatically
converted
back
to
their
JSON-native
counterparts
in
when
<a href="#rdf-conversion">
converting
from
RDF
</a>.
</p>
<del class="diff-old">Note
</del>
<p>
Some
JSON
serializers,
such
as
PHP's
native
implementation
in
some
versions,
backslash-escape
the
forward
slash
character.
For
example,
the
value
<code>
http://example.com/
</code>
would
be
serialized
as
<code>
http:\/\/example.com\/
</code>.
This
is
problematic
as
other
JSON
parsers
might
not
understand
those
escaping
characters.
There
is
no
need
to
backslash-escape
forward
slashes
in
JSON-LD.
To
aid
interoperability
between
JSON-LD
processors,
a
JSON-LD
serializer
<em class="rfc2119" title="must not">
must
not
</em>
backslash-escape
forward
slashes.
</p>
</section>
</section>
</section>
<section id="the-application-programming-interface">
<h2>
<span class="secno">
<ins class="diff-new">6.
</ins></span><ins class="diff-new">
The
Application
Programming
Interface
</ins></h2><p><ins class="diff-new">
This
API
provides
a
clean
mechanism
that
enables
developers
to
convert
JSON-LD
data
into
a
a
variety
of
output
formats
that
are
easier
to
work
with
in
various
programming
languages.
If
a
JSON-LD
API
is
provided
in
a
programming
environment,
the
entirety
of
the
following
API
</ins><em class="rfc2119" title="must"><ins class="diff-new">
must
</ins></em><ins class="diff-new">
be
implemented.
</ins></p><section id="jsonldprocessor"><h3><span class="secno"><ins class="diff-new">
6.1
</ins></span><ins class="diff-new">
JsonLdProcessor
</ins></h3><p><ins class="diff-new">
The
JSON-LD
processor
interface
is
the
high-level
programming
structure
that
developers
use
to
access
the
JSON-LD
transformation
methods.
</ins></p><p><ins class="diff-new">
The
JSON-LD
API
signatures
are
the
same
across
all
programming
languages.
Due
to
the
fact
that
asynchronous
programming
is
uncommon
in
certain
languages,
developers
</ins><em class="rfc2119" title="may"><ins class="diff-new">
may
</ins></em><ins class="diff-new">
implement
a
processor
with
a
synchronous
interface
instead.
In
that
case,
the
</ins><code><ins class="diff-new">
callback
</ins></code><ins class="diff-new">
parameter
</ins><em class="rfc2119" title="must not"><ins class="diff-new">
must
not
</ins></em><ins class="diff-new">
be
included
and
the
result
</ins><em class="rfc2119" title="must"><ins class="diff-new">
must
</ins></em><ins class="diff-new">
be
returned
as
a
return
value
instead.
</ins></p><p><ins class="diff-new">
It
is
important
to
highlight
that
conformant
</ins><a class="tref internalDFN" title="json-ld_processor" href="#dfn-json-ld_processor"><ins class="diff-new">
JSON-LD
processors
</ins></a><em class="rfc2119" title="must not"><ins class="diff-new">
must
not
</ins></em><ins class="diff-new">
modify
the
input
parameters.
</ins></p>    <pre class="idl"><span class="idlInterface" id="idl-def-JsonLdProcessor">[<span class="extAttr">Constructor</span>]<ins class="diff-new">
interface <span class="idlInterfaceID">JsonLdProcessor</span> {
</ins><span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-expand-void-object-object---DOMString-input-JsonLdCallback-callback-JsonLdOptions-options">expand</a></span> (<span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>object[]</a> or <a>DOMString</a>)</span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType"><a href="#idl-def-JsonLdCallback" class="idlType"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-JsonLdOptions" class="idlType"><code>JsonLdOptions</code></a>?</span> <span class="idlParamName">options</span></span>);</span><span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-compact-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options">compact</a></span> (<span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>object[]</a> or <a>DOMString</a>)</span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>DOMString</a>)</span> <span class="idlParamName">context</span></span>, <span class="idlParam"><span class="idlParamType"><a href="#idl-def-JsonLdCallback" class="idlType"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-JsonLdOptions" class="idlType"><code>JsonLdOptions</code></a>?</span> <span class="idlParamName">options</span></span>);</span><span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-flatten-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options">flatten</a></span> (<span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>object[]</a> or <a>DOMString</a>)</span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>DOMString</a>)?</span> <span class="idlParamName">context</span></span>, <span class="idlParam"><span class="idlParamType"><a href="#idl-def-JsonLdCallback" class="idlType"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-JsonLdOptions" class="idlType"><code>JsonLdOptions</code></a>?</span> <span class="idlParamName">options</span></span>);</span><ins class="diff-new">
};
</ins></span></pre><section id="methods"><h4><span class="secno"><ins class="diff-new">
6.1.1
</ins></span><ins class="diff-new">
Methods
</ins></h4><dl class="methods"><dt id="widl-JsonLdProcessor-compact-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options"><code><ins class="diff-new">
compact
</ins></code></dt><dd><a href="#compaction"><ins class="diff-new">
Compacts
</ins></a><ins class="diff-new">
the
given
</ins><code><ins class="diff-new">
input
</ins></code><ins class="diff-new">
using
the
</ins><code><ins class="diff-new">
context
</ins></code><ins class="diff-new">
according
to
the
steps
in
the
</ins><a href="#compaction-algorithm"><ins class="diff-new">
Compaction
Algorithm
</ins></a>.<table class="parameters"><tr><th><ins class="diff-new">
Parameter
</ins></th><th><ins class="diff-new">
Type
</ins></th><th><ins class="diff-new">
Nullable
</ins></th><th><ins class="diff-new">
Optional
</ins></th><th><ins class="diff-new">
Description
</ins></th></tr><tr><td class="prmName"><ins class="diff-new">
input
</ins></td><td class="prmType"><code><ins class="diff-new">
(
</ins><a><ins class="diff-new">
object
</ins></a><ins class="diff-new">
or
</ins><a><ins class="diff-new">
object[]
</ins></a><ins class="diff-new">
or
</ins><a><ins class="diff-new">
DOMString
</ins></a><ins class="diff-new">
)
</ins></code></td><td class="prmNullFalse"><ins class="diff-new">
✘
</ins></td><td class="prmOptFalse"><ins class="diff-new">
✘
</ins></td><td class="prmDesc"><ins class="diff-new">
The
JSON-LD
object
or
array
of
JSON-LD
objects
to
perform
the
compaction
upon
or
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
referencing
the
JSON-LD
document
to
compact.
</ins></td></tr><tr><td class="prmName"><ins class="diff-new">
context
</ins></td><td class="prmType"><code><ins class="diff-new">
(
</ins><a><ins class="diff-new">
object
</ins></a><ins class="diff-new">
or
</ins><a><ins class="diff-new">
DOMString
</ins></a><ins class="diff-new">
)
</ins></code></td><td class="prmNullFalse"><ins class="diff-new">
✘
</ins></td><td class="prmOptFalse"><ins class="diff-new">
✘
</ins></td><td class="prmDesc"><ins class="diff-new">
The
context
to
use
when
compacting
the
</ins><code><ins class="diff-new">
input
</ins></code><ins class="diff-new">
;
either
in
the
form
of
an
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
or
as
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>.</td></tr><tr><td class="prmName"><ins class="diff-new">
callback
</ins></td><td class="prmType"><code><a href="#idl-def-JsonLdCallback" class="idlType"><code><ins class="diff-new">
JsonLdCallback
</ins></code></a></code></td><td class="prmNullFalse"><ins class="diff-new">
✘
</ins></td><td class="prmOptFalse"><ins class="diff-new">
✘
</ins></td><td class="prmDesc"><ins class="diff-new">
A
callback
that
is
called
when
processing
is
complete
on
the
given
</ins><code><ins class="diff-new">
input
</ins></code>.</td></tr><tr><td class="prmName"><ins class="diff-new">
options
</ins></td><td class="prmType"><code><a href="#idl-def-JsonLdOptions" class="idlType"><code><ins class="diff-new">
JsonLdOptions
</ins></code></a></code></td><td class="prmNullTrue"><ins class="diff-new">
✔
</ins></td><td class="prmOptTrue"><ins class="diff-new">
✔
</ins></td><td class="prmDesc"><ins class="diff-new">
A
set
of
options
to
configure
the
used
algorithms
such.
This
allows,
e.g.,
to
set
the
input
document's
base
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>.<ins class="diff-new">
This
also
includes
the
</ins><code><ins class="diff-new">
optimize
</ins></code><ins class="diff-new">
flag,
which,
if
set,
will
allow
processor-specific
optimization.
</ins></td></tr></table><div><em><ins class="diff-new">
Return
type:
</ins></em><code><a><ins class="diff-new">
void
</ins></a></code></div></dd><dt id="widl-JsonLdProcessor-expand-void-object-object---DOMString-input-JsonLdCallback-callback-JsonLdOptions-options"><code><ins class="diff-new">
expand
</ins></code></dt><dd><a href="#expansion"><ins class="diff-new">
Expands
</ins></a><ins class="diff-new">
the
given
</ins><code><ins class="diff-new">
input
</ins></code><ins class="diff-new">
according
to
the
steps
in
the
</ins><a href="#expansion-algorithm"><ins class="diff-new">
Expansion
Algorithm
</ins></a>.<table class="parameters"><tr><th><ins class="diff-new">
Parameter
</ins></th><th><ins class="diff-new">
Type
</ins></th><th><ins class="diff-new">
Nullable
</ins></th><th><ins class="diff-new">
Optional
</ins></th><th><ins class="diff-new">
Description
</ins></th></tr><tr><td class="prmName"><ins class="diff-new">
input
</ins></td><td class="prmType"><code><ins class="diff-new">
(
</ins><a><ins class="diff-new">
object
</ins></a><ins class="diff-new">
or
</ins><a><ins class="diff-new">
object[]
</ins></a><ins class="diff-new">
or
</ins><a><ins class="diff-new">
DOMString
</ins></a><ins class="diff-new">
)
</ins></code></td><td class="prmNullFalse"><ins class="diff-new">
✘
</ins></td><td class="prmOptFalse"><ins class="diff-new">
✘
</ins></td><td class="prmDesc"><ins class="diff-new">
The
JSON-LD
object
or
array
of
JSON-LD
objects
to
perform
the
expansion
upon
or
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
referencing
the
JSON-LD
document
to
expand.
</ins></td></tr><tr><td class="prmName"><ins class="diff-new">
callback
</ins></td><td class="prmType"><code><a href="#idl-def-JsonLdCallback" class="idlType"><code><ins class="diff-new">
JsonLdCallback
</ins></code></a></code></td><td class="prmNullFalse"><ins class="diff-new">
✘
</ins></td><td class="prmOptFalse"><ins class="diff-new">
✘
</ins></td><td class="prmDesc"><ins class="diff-new">
A
callback
that
is
called
when
processing
is
complete
on
the
given
</ins><code><ins class="diff-new">
input
</ins></code>.</td></tr><tr><td class="prmName"><ins class="diff-new">
options
</ins></td><td class="prmType"><code><a href="#idl-def-JsonLdOptions" class="idlType"><code><ins class="diff-new">
JsonLdOptions
</ins></code></a></code></td><td class="prmNullTrue"><ins class="diff-new">
✔
</ins></td><td class="prmOptTrue"><ins class="diff-new">
✔
</ins></td><td class="prmDesc"><ins class="diff-new">
A
set
of
options
to
configure
the
used
algorithms
such.
This
allows,
e.g.,
to
set
the
input
document's
base
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>.</td></tr></table><div><em><ins class="diff-new">
Return
type:
</ins></em><code><a><ins class="diff-new">
void
</ins></a></code></div></dd><dt id="widl-JsonLdProcessor-flatten-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options"><code><ins class="diff-new">
flatten
</ins></code></dt><dd><a href="#flattening"><ins class="diff-new">
Flattens
</ins></a><ins class="diff-new">
the
given
</ins><code><ins class="diff-new">
input
</ins></code><ins class="diff-new">
and
</ins><a href="#compaction"><ins class="diff-new">
compacts
</ins></a><ins class="diff-new">
it
using
the
passed
</ins><code><ins class="diff-new">
context
</ins></code><ins class="diff-new">
according
to
the
steps
in
the
</ins><a href="#flattening-algorithm"><ins class="diff-new">
Flattening
Algorithm
</ins></a>.<table class="parameters"><tr><th><ins class="diff-new">
Parameter
</ins></th><th><ins class="diff-new">
Type
</ins></th><th><ins class="diff-new">
Nullable
</ins></th><th><ins class="diff-new">
Optional
</ins></th><th><ins class="diff-new">
Description
</ins></th></tr><tr><td class="prmName"><ins class="diff-new">
input
</ins></td><td class="prmType"><code><ins class="diff-new">
(
</ins><a><ins class="diff-new">
object
</ins></a><ins class="diff-new">
or
</ins><a><ins class="diff-new">
object[]
</ins></a><ins class="diff-new">
or
</ins><a><ins class="diff-new">
DOMString
</ins></a><ins class="diff-new">
)
</ins></code></td><td class="prmNullFalse"><ins class="diff-new">
✘
</ins></td><td class="prmOptFalse"><ins class="diff-new">
✘
</ins></td><td class="prmDesc"><ins class="diff-new">
The
JSON-LD
object
or
array
of
JSON-LD
objects
or
an
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
referencing
the
JSON-LD
document
to
flatten.
</ins></td></tr><tr><td class="prmName"><ins class="diff-new">
context
</ins></td><td class="prmType"><code><ins class="diff-new">
(
</ins><a><ins class="diff-new">
object
</ins></a><ins class="diff-new">
or
</ins><a><ins class="diff-new">
DOMString
</ins></a><ins class="diff-new">
)
</ins></code></td><td class="prmNullTrue"><ins class="diff-new">
✔
</ins></td><td class="prmOptFalse"><ins class="diff-new">
✘
</ins></td><td class="prmDesc"><ins class="diff-new">
The
context
to
use
when
compacting
the
flattened
</ins><code><ins class="diff-new">
input
</ins></code><ins class="diff-new">
;
either
in
the
form
of
an
</ins><a class="tref internalDFN" title="json_object" href="#dfn-json_object"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
or
as
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>.<ins class="diff-new">
If
</ins><a class="tref internalDFN" title="null" href="#dfn-null"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
is
passed,
the
result
will
not
be
compacted
but
keept
in
expanded
form.
</ins></td></tr><tr><td class="prmName"><ins class="diff-new">
callback
</ins></td><td class="prmType"><code><a href="#idl-def-JsonLdCallback" class="idlType"><code><ins class="diff-new">
JsonLdCallback
</ins></code></a></code></td><td class="prmNullFalse"><ins class="diff-new">
✘
</ins></td><td class="prmOptFalse"><ins class="diff-new">
✘
</ins></td><td class="prmDesc"><ins class="diff-new">
A
callback
that
is
called
when
processing
is
complete
on
the
given
</ins><code><ins class="diff-new">
input
</ins></code>.</td></tr><tr><td class="prmName"><ins class="diff-new">
options
</ins></td><td class="prmType"><code><a href="#idl-def-JsonLdOptions" class="idlType"><code><ins class="diff-new">
JsonLdOptions
</ins></code></a></code></td><td class="prmNullTrue"><ins class="diff-new">
✔
</ins></td><td class="prmOptTrue"><ins class="diff-new">
✔
</ins></td><td class="prmDesc"><ins class="diff-new">
A
set
of
options
to
configure
the
used
algorithms
such.
This
allows,
e.g.,
to
set
the
input
document's
base
</ins><a class="tref internalDFN" title="iri" href="#dfn-iri"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>.</td></tr></table><div><em><ins class="diff-new">
Return
type:
</ins></em><code><a><ins class="diff-new">
void
</ins></a></code></div></dd></dl></section></section><section id="callbacks"><h3><span class="secno"><ins class="diff-new">
6.2
</ins></span><ins class="diff-new">
Callbacks
</ins></h3><p><ins class="diff-new">
JSON-LD
processors
utilize
callbacks
in
order
to
return
information
in
an
asynchronous
manner
to
calling
applications.
This
section
details
the
parameters
sent
to
those
callbacks.
</ins></p><section id="jsonldcallback"><h4><span class="secno"><ins class="diff-new">
6.2.1
</ins></span><ins class="diff-new">
JsonLdCallback
</ins></h4><p><ins class="diff-new">
The
</ins><a href="#idl-def-JsonLdCallback" class="idlType"><code><ins class="diff-new">
JsonLdCallback
</ins></code></a><ins class="diff-new">
is
called
when
processing
of
an
API
method
of
</ins><a href="#idl-def-JsonLdProcessor" class="idlType"><code><ins class="diff-new">
JsonLdProcessor
</ins></code></a><ins class="diff-new">
has
been
completed
successfully
or
been
terminated
by
an
error.
</ins></p><pre class="idl"><span class="idlCallback" id="idl-def-JsonLdCallback"><ins class="diff-new">
callback
</ins><span class="idlCallbackID"><ins class="diff-new">
JsonLdCallback
</ins></span><ins class="diff-new">
=
</ins><span class="idlCallbackType"><a><ins class="diff-new">
void
</ins></a></span><ins class="diff-new">
(
</ins><span class="idlParam"><span class="idlParamType"><a href="#idl-def-JsonLdProcessingError" class="idlType"><code><ins class="diff-new">
JsonLdProcessingError
</ins></code></a></span><span class="idlParamName"><ins class="diff-new">
error
</ins></span></span>,<span class="idlParam"><span class="idlParamType"><a><ins class="diff-new">
object
or
object
</ins></a><ins class="diff-new">
[]
</ins></span><span class="idlParamName"><ins class="diff-new">
document
</ins></span></span><ins class="diff-new">
);
</ins></span></pre><section><h5 id="callback-jsonldcallback-parameters"><ins class="diff-new">
Callback
</ins><a class="idlType" href="#idl-def-JsonLdCallback"><code><ins class="diff-new">
JsonLdCallback
</ins></code></a><ins class="diff-new">
Parameters
</ins></h5><dl class="callback-members"><dt id="widl-JsonLdCallback-error"><code><ins class="diff-new">
error
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a href="#idl-def-JsonLdProcessingError" class="idlType"><code><ins class="diff-new">
JsonLdProcessingError
</ins></code></a></span></dt><dd><ins class="diff-new">
If
the
value
is
</ins><code><ins class="diff-new">
null
</ins></code>,<ins class="diff-new">
then
no
error
occurred.
If
the
value
is
non-
</ins><code><ins class="diff-new">
null
</ins></code>,<ins class="diff-new">
a
processing
error
occurred
and
the
details
will
be
contained
within
the
</ins><code><ins class="diff-new">
error
</ins></code><ins class="diff-new">
object.
</ins></dd><dt id="widl-JsonLdCallback-document"><code><ins class="diff-new">
document
</ins></code><ins class="diff-new">
of
type
array
of
</ins><span class="idlMemberType"><a><ins class="diff-new">
object
or
object
</ins></a></span></dt><dd><ins class="diff-new">
The
processed
JSON-LD
document.
</ins></dd></dl></section></section></section><section id="data-structures"><h3><span class="secno"><ins class="diff-new">
6.3
</ins></span><ins class="diff-new">
Data
Structures
</ins></h3><p><ins class="diff-new">
This
section
describes
datatype
definitions
used
within
the
JSON-LD
API.
</ins></p><section id="jsonldoptions"><h4><span class="secno"><ins class="diff-new">
6.3.1
</ins></span><ins class="diff-new">
JsonLdOptions
</ins></h4><p><ins class="diff-new">
The
</ins><a href="#idl-def-JsonLdOptions" class="idlType"><code><ins class="diff-new">
JsonLdOptions
</ins></code></a><ins class="diff-new">
type
is
used
to
pass
various
options
to
the
</ins><a href="#idl-def-JsonLdProcessor" class="idlType"><code><ins class="diff-new">
JsonLdProcessor
</ins></code></a><ins class="diff-new">
methods.
</ins></p>      <pre class="idl"><span class="idlDictionary" id="idl-def-JsonLdOptions">dictionary <span class="idlDictionaryID">JsonLdOptions</span> {<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a></span>           <span class="idlMemberName"><a href="#widl-JsonLdOptions-base">base</a></span>;</span><span class="idlMember">    <span class="idlMemberType"><a>object or DOMString</a></span> <span class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext">expandContext</a></span> = <span class="idlMemberValue">null</span>;</span><span class="idlMember">    <span class="idlMemberType"><a>boolean</a></span>             <span class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays">compactArrays</a></span> = <span class="idlMemberValue">true</span>;</span><span class="idlMember">    <span class="idlMemberType"><a>boolean</a></span>             <span class="idlMemberName"><a href="#widl-JsonLdOptions-optimize">optimize</a></span> = <span class="idlMemberValue">false</span>;</span><span class="idlMember">    <span class="idlMemberType"><a>boolean</a></span>             <span class="idlMemberName"><a href="#widl-JsonLdOptions-useRdfType">useRdfType</a></span> = <span class="idlMemberValue">false</span>;</span><span class="idlMember">    <span class="idlMemberType"><a>boolean</a></span>             <span class="idlMemberName"><a href="#widl-JsonLdOptions-useNativeTypes">useNativeTypes</a></span> = <span class="idlMemberValue">true</span>;</span><ins class="diff-new">
};
</ins></span></pre><section><h5 id="dictionary-jsonldoptions-members"><ins class="diff-new">
Dictionary
</ins><a class="idlType" href="#idl-def-JsonLdOptions"><code><ins class="diff-new">
JsonLdOptions
</ins></code></a><ins class="diff-new">
Members
</ins></h5><dl class="dictionary-members"><dt id="widl-JsonLdOptions-base"><code><ins class="diff-new">
base
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
DOMString
</ins></a></span></dt><dd><ins class="diff-new">
The
Base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
to
use
when
expanding
the
document.
This
overrides
the
value
of
</ins><em><ins class="diff-new">
input
</ins></em><ins class="diff-new">
if
it
is
a
</ins><a><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>.<ins class="diff-new">
If
not
specified
and
</ins><em><ins class="diff-new">
input
</ins></em><ins class="diff-new">
is
not
an
</ins><a><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>,<ins class="diff-new">
the
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
defaults
to
the
current
document
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
if
in
a
browser
context,
or
the
empty
string
if
there
is
no
document
context.
</ins></dd><dt id="widl-JsonLdOptions-compactArrays"><code><ins class="diff-new">
compactArrays
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
boolean
</ins></a></span>,<ins class="diff-new">
defaulting
to
</ins><code><ins class="diff-new">
true
</ins></code></dt><dd><ins class="diff-new">
If
set
to
</ins><code><ins class="diff-new">
true
</ins></code>,<ins class="diff-new">
the
JSON-LD
processor
replaces
arrays
with
just
one
element
with
that
element
during
compaction.
If
set
to
</ins><code><ins class="diff-new">
false
</ins></code>,<ins class="diff-new">
all
arrays
will
remain
arrays
even
if
they
have
just
one
element.
</ins></dd><dt id="widl-JsonLdOptions-expandContext"><code><ins class="diff-new">
expandContext
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
object
or
DOMString
</ins></a></span>,<ins class="diff-new">
defaulting
to
</ins><code><ins class="diff-new">
null
</ins></code></dt><dd><ins class="diff-new">
A
context
that
is
used
to
initialize
the
active
context
when
expanding
a
document.
</ins></dd><dt id="widl-JsonLdOptions-optimize"><code><ins class="diff-new">
optimize
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
boolean
</ins></a></span>,<ins class="diff-new">
defaulting
to
</ins><code><ins class="diff-new">
false
</ins></code></dt><dd><ins class="diff-new">
If
set
to
</ins><code><ins class="diff-new">
true
</ins></code>,<ins class="diff-new">
the
JSON-LD
processor
is
allowed
to
optimize
the
output
of
the
</ins><a href="#compaction-algorithm"><ins class="diff-new">
Compaction
Algorithm
</ins></a><ins class="diff-new">
to
produce
even
compacter
representations.
The
algorithm
for
compaction
optimization
is
beyond
the
scope
of
this
specification
and
thus
not
defined.
Consequently,
different
implementations
</ins><em class="rfc2119" title="may"><ins class="diff-new">
may
</ins></em><ins class="diff-new">
implement
different
optimization
algorithms.
</ins></dd><dt id="widl-JsonLdOptions-useNativeTypes"><code><ins class="diff-new">
useNativeTypes
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
boolean
</ins></a></span>,<ins class="diff-new">
defaulting
to
</ins><code><ins class="diff-new">
true
</ins></code></dt><dd><ins class="diff-new">
If
set
to
</ins><code><ins class="diff-new">
true
</ins></code>,<ins class="diff-new">
the
JSON-LD
processor
will
try
to
convert
</ins><a class="tref internalDFN" title="typed_value" href="#dfn-typed_value"><ins class="diff-new">
typed
values
</ins></a><ins class="diff-new">
to
JSON
native
types
instead
of
using
the
expanded
object
form
when
</ins><a href="#convert-from-rdf-algorithm"><ins class="diff-new">
converting
from
RDF
</ins></a>.<code><ins class="diff-new">
xsd:boolean
</ins></code><ins class="diff-new">
values
will
be
converted
to
</ins><a class="tref internalDFN" title="true" href="#dfn-true"><ins class="diff-new">
true
</ins></a><ins class="diff-new">
or
</ins><a class="tref internalDFN" title="false" href="#dfn-false"><ins class="diff-new">
false
</ins></a>.<code><ins class="diff-new">
xsd:integer
</ins></code><ins class="diff-new">
and
</ins><code><ins class="diff-new">
xsd:double
</ins></code><ins class="diff-new">
values
will
be
converted
to
</ins><a class="tref internalDFN" title="number" href="#dfn-number"><ins class="diff-new">
JSON
numbers
</ins></a>.</dd><dt id="widl-JsonLdOptions-useRdfType"><code><ins class="diff-new">
useRdfType
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
boolean
</ins></a></span>,<ins class="diff-new">
defaulting
to
</ins><code><ins class="diff-new">
false
</ins></code></dt><dd><ins class="diff-new">
If
set
to
</ins><code><ins class="diff-new">
true
</ins></code>,<ins class="diff-new">
the
JSON-LD
processor
will
use
the
expanded
</ins><code><ins class="diff-new">
rdf:type
</ins></code><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
as
the
property
instead
of
</ins><code><ins class="diff-new">
@type
</ins></code><ins class="diff-new">
when
</ins><a href="#convert-from-rdf-algorithm"><ins class="diff-new">
converting
from
RDF
</ins></a>.</dd></dl></section></section><section id="jsonldprocessingerror"><h4><span class="secno"><ins class="diff-new">
6.3.2
</ins></span><ins class="diff-new">
JsonLdProcessingError
</ins></h4><div class="issue"><div class="issue-title"><a href="https://github.com/json-ld/json-ld.org/issues/153"><span><ins class="diff-new">
Issue
153
</ins></span></a></div><p class=""><ins class="diff-new">
Developers
should
note
that
the
details
of
error
handling
are
being
actively
debated.
</ins></p>
</div>
<p>
<ins class="diff-new">The
</ins><a href="#idl-def-JsonLdProcessingError" class="idlType"><code><ins class="diff-new">
JsonLdProcessingError
</ins></code></a><ins class="diff-new">
type
is
used
to
report
errors
to
a
</ins><a href="#idl-def-JsonLdCallback" class="idlType"><code><ins class="diff-new">
JsonLdCallback
</ins></code></a>.</p>      <pre class="idl"><span class="idlDictionary" id="idl-def-JsonLdProcessingError">dictionary <span class="idlDictionaryID">JsonLdProcessingError</span> {<span class="idlMember">    <span class="idlMemberType"><a href="#idl-def-JsonLdErrorCode" class="idlType"><code>JsonLdErrorCode</code></a></span> <span class="idlMemberName"><a href="#widl-JsonLdProcessingError-code">code</a></span>;</span><span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>      <span class="idlMemberName"><a href="#widl-JsonLdProcessingError-message">message</a></span>;</span><ins class="diff-new">
};
</ins></span></pre><section><h5 id="dictionary-jsonldprocessingerror-members"><ins class="diff-new">
Dictionary
</ins><a class="idlType" href="#idl-def-JsonLdProcessingError"><code><ins class="diff-new">
JsonLdProcessingError
</ins></code></a><ins class="diff-new">
Members
</ins></h5><dl class="dictionary-members"><dt id="widl-JsonLdProcessingError-code"><code><ins class="diff-new">
code
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a href="#idl-def-JsonLdErrorCode" class="idlType"><code><ins class="diff-new">
JsonLdErrorCode
</ins></code></a></span></dt><dd><ins class="diff-new">
a
string
representing
the
particular
error
type,
as
described
in
the
various
algorithms
in
this
document.
</ins></dd><dt id="widl-JsonLdProcessingError-message"><code><ins class="diff-new">
message
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
DOMString
</ins></a></span>,<ins class="diff-new">
nullable
</ins></dt><dd><ins class="diff-new">
an
optional
error
message
containing
additional
debugging
information.
The
specific
contents
of
error
messages
are
outside
the
scope
of
this
specification
and
thus
implementation
dependent.
</ins></dd></dl></section></section><section id="jsonlderrorcode"><h4><span class="secno"><ins class="diff-new">
6.3.3
</ins></span><ins class="diff-new">
JsonLdErrorCode
</ins></h4><p><ins class="diff-new">
The
JsonLdErrorCode
represent
the
collection
of
valid
JSON-LD
error
codes.
</ins></p>      <pre class="idl"><span class="idlEnum" id="idl-def-JsonLdErrorCode">enum <span class="idlEnumID">JsonLdErrorCode</span> {<ins class="diff-new">
    &quot;<span class="idlEnumItem">INVALID_SYNTAX</span>&quot;,
    &quot;<span class="idlEnumItem">LOAD_ERROR</span>&quot;,
    &quot;<span class="idlEnumItem">LIST_OF_LISTS_DETECTED</span>&quot;
};
</ins></span></pre><table class="simple"><tr><th colspan="2"><ins class="diff-new">
Enumeration
description
</ins></th></tr><tr><td><code><ins class="diff-new">
INVALID_SYNTAX
</ins></code></td><td><ins class="diff-new">
A
violation
of
the
grammar
as
defined
by
the
JSON-LD
syntax
specification
[
</ins><cite><a class="bibref" href="#bib-JSON-LD"><ins class="diff-new">
JSON-LD
</ins></a></cite><ins class="diff-new">
]
was
detected.
</ins></td></tr><tr><td><code><ins class="diff-new">
LOAD_ERROR
</ins></code></td><td><ins class="diff-new">
There
was
a
problem
encountered
loading
a
remote
context.
</ins></td></tr><tr><td><code><ins class="diff-new">
LIST_OF_LISTS_DETECTED
</ins></code></td><td><ins class="diff-new">
A
list
of
lists
was
detected.
List
of
lists
are
not
supported
in
this
version
of
JSON-LD
due
to
the
algorithmic
complexity
associated
with
conversion
to
RDF.
</ins></td></tr></table></section></section>
</section>
<section class="appendix" id="acknowledgements">
<h2>
<span class="secno">
A.
</span>
Acknowledgements
</h2>
<p>
A
large
amount
of
thanks
goes
out
to
the
JSON-LD
Community
Group
participants
who
worked
through
many
of
the
technical
issues
on
the
mailing
list
and
the
weekly
telecons
-
of
special
mention
are
Niklas
Lindström,
François
Daoust,
<ins class="diff-new">Lin
Clark,
</ins>
and
Zdenko
'Denny'
Vrandečić.
The
editors
would
like
to
thank
Mark
Birbeck,
who
provided
a
great
deal
of
the
initial
push
behind
the
JSON-LD
work
via
his
work
on
RDFj.
The
work
of
Dave
Lehn
and
Mike
Johnson
are
appreciated
for
reviewing,
and
performing
several
implementations
of
the
specification.
Ian
Davis
is
thanked
for
<del class="diff-old">this
</del>
<ins class="diff-chg">his
</ins>
work
on
RDF/JSON.
Thanks
also
to
Nathan
Rixham,
Bradley
P.
Allen,
Kingsley
Idehen,
Glenn
McDonald,
Alexandre
Passant,
Danny
Ayers,
Ted
Thibodeau
Jr.,
Olivier
Grisel,
Josh
Mandel,
Eric
Prud'hommeaux,
David
Wood,
Guus
Schreiber,
Pat
Hayes,
Sandro
Hawke,
and
Richard
Cyganiak
<del class="diff-old">for
</del>
<ins class="diff-chg">or
</ins>
their
input
on
the
specification.
</p>
</section>
<section id="references" class="appendix" typeof="bibo:Chapter" resource="#references" rel="bibo:chapter">
<h2>
<span class="secno">
B.
</span>
References
</h2>
<section id="normative-references" typeof="bibo:Chapter" resource="#normative-references" rel="bibo:chapter">
<h3>
<span class="secno">
B.1
</span>
Normative
references
</h3>
<del class="diff-old">[BCP47]
A.
Phillips;
M.
Davis.
Tags
for
Identifying
Languages
September
2009.
IETF
Best
Current
Practice.
URL:
http://tools.ietf.org/html/bcp47
</del>
<dl class="bibliography" about="">
<dt id="bib-IEEE-754-1985">
[IEEE-754-1985]
</dt>
<dd rel="dcterms:requires">
IEEE.
<cite>
IEEE
Standard
for
Binary
Floating-Point
Arithmetic.
</cite>
See
<a href="http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html">
http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html
</a>
</dd>
<dt id="bib-JSON-LD">
[JSON-LD]
</dt>
<dd rel="dcterms:requires">
<cite>
<a href="http://json-ld.org/spec/ED/json-ld-syntax/20120522/">
The
JSON-LD
Syntax
</a>
</cite>
Manu
Sporny,
Gregg
Kellogg,
Markus
Lanthaler
Editors.
World
Wide
Web
Consortium
(work
in
progress).
22
May
2012.
Editor's
Draft.
This
edition
of
the
JSON-LD
Syntax
specification
is
http://json-ld.org/spec/ED/json-ld-syntax/20120522/.
The
<a href="http://json-ld.org/spec/latest/json-ld-syntax/">
latest
edition
of
the
JSON-LD
Syntax
</a>
is
available
at
http://json-ld.org/spec/latest/json-ld-syntax/
</dd>
<del class="diff-old">[JSON-POINTER]
JSON
Pointer
P.
Bryan,
Ed.
IETF
Draft.
URL:
http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-02
</del>
<dt id="bib-RDF-CONCEPTS">
[RDF-CONCEPTS]
</dt>
<dd rel="dcterms:requires">
<cite>
<a href="http://www.w3.org/TR/2011/WD-rdf11-concepts-20110830/">
RDF
1.1
Concepts
and
Abstract
Syntax
</a>
</cite>
Richard
Cyganiak,
David
Wood,
Editors.
World
Wide
Web
Consortium
(work
in
progress).
30
May
2012.
Editor's
Draft.
This
edition
of
the
JSON-LD
Syntax
specification
is
http://www.w3.org/TR/2011/WD-rdf11-concepts-20110830/.
The
<a href="http://www.w3.org/TR/rdf11-concepts/">
latest
edition
of
the
JSON-LD
Syntax
</a>
is
available
at
http://www.w3.org/TR/rdf11-concepts/
</dd>
<dt id="bib-RDF-SCHEMA">
[RDF-SCHEMA]
</dt>
<dd rel="dcterms:requires">
Dan
Brickley;
Ramanathan
V.
Guha.
<a href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210">
<cite>
RDF
Vocabulary
Description
Language
1.0:
RDF
Schema.
</cite>
</a>
10
February
2004.
W3C
Recommendation.
URL:
<a href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210">
http://www.w3.org/TR/2004/REC-rdf-schema-20040210
</a>
</dd>
<dt id="bib-RFC2119">
<ins class="diff-new">[RFC2119]
</ins></dt><dd rel="dcterms:requires"><ins class="diff-new">
S.
Bradner.
</ins><a href="http://www.ietf.org/rfc/rfc2119.txt"><cite><ins class="diff-new">
Key
words
for
use
in
RFCs
to
Indicate
Requirement
Levels.
</ins></cite></a><ins class="diff-new">
March
1997.
Internet
RFC
2119.
URL:
</ins><a href="http://www.ietf.org/rfc/rfc2119.txt"><ins class="diff-new">
http://www.ietf.org/rfc/rfc2119.txt
</ins></a></dd>
<dt id="bib-RFC3986">
[RFC3986]
</dt>
<dd rel="dcterms:requires">
T.
Berners-Lee;
R.
Fielding;
L.
Masinter.
<a href="http://www.ietf.org/rfc/rfc3986.txt">
<cite>
Uniform
Resource
Identifier
(URI):
Generic
Syntax.
</cite>
</a>
January
2005.
Internet
RFC
3986.
URL:
<a href="http://www.ietf.org/rfc/rfc3986.txt">
http://www.ietf.org/rfc/rfc3986.txt
</a>
</dd>
<dt id="bib-RFC3987">
[RFC3987]
</dt>
<dd rel="dcterms:requires">
M.
Dürst;
M.
Suignard.
<a href="http://www.ietf.org/rfc/rfc3987.txt">
<cite>
Internationalized
Resource
Identifiers
(IRIs).
</cite>
</a>
January
2005.
Internet
RFC
3987.
URL:
<a href="http://www.ietf.org/rfc/rfc3987.txt">
http://www.ietf.org/rfc/rfc3987.txt
</a>
</dd>
<dt id="bib-RFC4627">
[RFC4627]
</dt>
<dd rel="dcterms:requires">
D.
Crockford.
<a href="http://www.ietf.org/rfc/rfc4627.txt">
<cite>
The
application/json
Media
Type
for
JavaScript
Object
Notation
(JSON)
</cite>
</a>
July
2006.
Internet
RFC
4627.
URL:
<a href="http://www.ietf.org/rfc/rfc4627.txt">
http://www.ietf.org/rfc/rfc4627.txt
</a>
</dd>
<dt id="bib-WEBIDL">
[WEBIDL]
</dt>
<dd rel="dcterms:requires">
<cite>
<a href="http://www.w3.org/TR/2012/CR-WebIDL-20120419/">
Web
IDL
</a>
</cite>
Cameron
McCormack,
Editor.
World
Wide
Web
Consortium.
19
April
2012.
Candidate
Recommendataion.
This
edition
of
Web
IDL
is
http://www.w3.org/TR/2012/CR-WebIDL-20120419/.
The
<a href="http://dev.w3.org/2006/webapi/WebIDL/">
latest
edition
of
Web
IDL
</a>
is
available
at
http://dev.w3.org/2006/webapi/WebIDL/
</dd>
<dt id="bib-XMLSCHEMA11-2">
[XMLSCHEMA11-2]
</dt>
<dd rel="dcterms:requires">
Henry
S.
Thompson;
et
al.
<a href="http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/">
<cite>
W3C
XML
Schema
Definition
Language
(XSD)
1.1
Part
2:
Datatypes.
</cite>
</a>
5
April
2012.
W3C
Recommendation
URL:
<a href="http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/">
http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/
</a>
</dd>
</dl>
</section>
<section id="informative-references" typeof="bibo:Chapter" resource="#informative-references" rel="bibo:chapter">
<h3>
<span class="secno">
B.2
</span>
Informative
references
</h3>
<dl class="bibliography" about="">
<dt id="bib-BCP47">
<ins class="diff-chg">[BCP47]
</ins></dt><dd rel="dcterms:references"><ins class="diff-chg">
A.
Phillips;
M.
Davis.
</ins><a href="http://tools.ietf.org/html/bcp47"><cite><ins class="diff-chg">
Tags
for
Identifying
Languages
</ins></cite></a><ins class="diff-chg">
September
2009.
IETF
Best
Current
Practice.
URL:
</ins><a href="http://tools.ietf.org/html/bcp47"><ins class="diff-chg">
http://tools.ietf.org/html/bcp47
</ins></a></dd>
<dt id="bib-ECMA-262">
[ECMA-262]
</dt>
<dd rel="dcterms:references">
<a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
<cite>
ECMAScript
Language
Specification.
</cite>
</a>
June
2011.
URL:
<a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
http://www.ecma-international.org/publications/standards/Ecma-262.htm
</a>
</dd>
<dt id="bib-JSON-LD-TESTS">
<ins class="diff-new">[JSON-LD-TESTS]
</ins></dt><dd rel="dcterms:references"><cite><a href="http://dvcs.w3.org/hg/json-ld/raw-file/default/test-suite/"><ins class="diff-new">
JSON-LD
Test
Suite
</ins></a></cite><ins class="diff-new">
(work
in
progress).
</ins></dd>
<dt id="bib-TURTLE-TR">
[TURTLE-TR]
</dt>
<dd rel="dcterms:references">
Eric
Prud'hommeaux,
Gavin
Carothers.
<cite>
<a href="http://www.w3.org/TR/2011/WD-turtle-20110809/">
Turtle:
Terse
RDF
Triple
Language.
</a>
</cite>
09
August
2011.
W3C
Working
Draft.
URL:
<a href="http://www.w3.org/TR/2011/WD-turtle-20110809/">
http://www.w3.org/TR/2011/WD-turtle-20110809/
<del class="diff-old">[UNICODE]
The
Unicode
Consortium.
The
Unicode
Standard.
2003.
Defined
by:
The
Unicode
Standard,
Version
4.0
(Boston,
MA,
Addison-Wesley,
ISBN
0-321-18578-1),
as
updated
from
time
to
time
by
the
publication
of
new
versions
URL:
http://www.unicode.org/unicode/standard/versions/enumeratedversions.html
</del>
</a>
</dd>
</dl>
</section>
</section>
</body>
</html>
